Skip to content

Commit ecc0b7e

Browse files
committed
Bumped v0.12.0
Signed-off-by: Vishal Rana <[email protected]>
1 parent 5d015bd commit ecc0b7e

File tree

5 files changed

+140
-6
lines changed

5 files changed

+140
-6
lines changed

client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ type (
1414
logger *log.Logger
1515
}
1616

17+
Download struct {
18+
ID string `json:"id"`
19+
Name string `json:"name"`
20+
URL string `json:"url"`
21+
}
22+
1723
APIError struct {
1824
Code int `json:"code"`
1925
Message string `json:"message"`

dns.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package labstack
2+
3+
type (
4+
DNSLookupRequest struct {
5+
Domain string `json:"domain"`
6+
Type string `json:"type"`
7+
}
8+
9+
DNSLookupResponse struct {
10+
Records []DNSRecord
11+
}
12+
13+
DNSRecord struct {
14+
Type string `json:"type"`
15+
Name string `json:"name"`
16+
// Values - start
17+
A string `json:"a"`
18+
AAAA string `json:"aaaa"`
19+
CNAME string `json:"cname"`
20+
MX string `json:"mx"`
21+
NS string `json:"ms"`
22+
PTR string `json:"ptr"`
23+
Serial uint32 `json:"serial"`
24+
Refresh uint32 `json:"refresh"`
25+
Retry uint32 `json:"retry"`
26+
Expire uint32 `json:"expire"`
27+
Priority uint16 `json:"priority"`
28+
Weight uint16 `json:"weight"`
29+
Port uint16 `json:"port"`
30+
Target string `json:"target"`
31+
TXT []string `json:"txt"`
32+
// Values - end
33+
TTL uint32 `json:"ttl"`
34+
Class string `json:"class"`
35+
}
36+
)
37+
38+
func (c *Client) DNSLookup(req *DNSLookupRequest) (res *DNSLookupResponse, err *APIError) {
39+
res = new(DNSLookupResponse)
40+
_, e := c.resty.R().
41+
SetBody(req).
42+
SetResult(res).
43+
SetError(err).
44+
Post("/dns/lookup")
45+
if e != nil {
46+
err = new(APIError)
47+
err.Message = e.Error()
48+
}
49+
return
50+
}

image.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ package labstack
33
import "strconv"
44

55
type (
6-
Download struct {
7-
ID string `json:"id"`
8-
Name string `json:"name"`
9-
URL string `json:"url"`
10-
}
11-
126
ImageCompressRequest struct {
137
File string
148
}

pdf.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package labstack
2+
3+
type (
4+
PDFExtractImageRequest struct {
5+
File string
6+
}
7+
8+
PDFExtractImageResponse struct {
9+
*Download
10+
}
11+
12+
PDFToImageRequest struct {
13+
File string
14+
}
15+
16+
PDFToImageResponse struct {
17+
*Download
18+
}
19+
)
20+
21+
func (c *Client) PDFExtractImage(req *PDFExtractImageRequest) (res *PDFExtractImageResponse, err *APIError) {
22+
res = new(PDFExtractImageResponse)
23+
_, e := c.resty.R().
24+
SetFile("file", req.File).
25+
SetResult(res).
26+
SetError(err).
27+
Post("/pdf/extract-image")
28+
if e != nil {
29+
err = new(APIError)
30+
err.Message = e.Error()
31+
}
32+
return
33+
}
34+
35+
func (c *Client) PDFToImage(req *PDFToImageRequest) (res *PDFToImageResponse, err *APIError) {
36+
res = new(PDFToImageResponse)
37+
_, e := c.resty.R().
38+
SetFile("file", req.File).
39+
SetResult(res).
40+
SetError(err).
41+
Post("/pdf/to-image")
42+
if e != nil {
43+
err = new(APIError)
44+
err.Message = e.Error()
45+
}
46+
return
47+
}

word.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package labstack
2+
3+
type (
4+
WordLookupRequest struct {
5+
Word string `json:"word"`
6+
}
7+
8+
WordLookupResponse struct {
9+
Pronunciation []string
10+
Rhymes []string
11+
Noun []*WordLookupResult
12+
Verb []*WordLookupResult
13+
Adverb []*WordLookupResult
14+
Adjective []*WordLookupResult
15+
}
16+
17+
WordLookupResult struct {
18+
Definition string
19+
Synonyms []string
20+
Antonyms []string
21+
Examples []string
22+
}
23+
)
24+
25+
func (c *Client) WordLookup(req *WordLookupRequest) (res *WordLookupResponse, err *APIError) {
26+
res = new(WordLookupResponse)
27+
_, e := c.resty.R().
28+
SetBody(req).
29+
SetResult(res).
30+
SetError(err).
31+
Post("/word/lookup")
32+
if e != nil {
33+
err = new(APIError)
34+
err.Message = e.Error()
35+
}
36+
return
37+
}

0 commit comments

Comments
 (0)