File tree Expand file tree Collapse file tree 5 files changed +140
-6
lines changed Expand file tree Collapse file tree 5 files changed +140
-6
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ type (
14
14
logger * log.Logger
15
15
}
16
16
17
+ Download struct {
18
+ ID string `json:"id"`
19
+ Name string `json:"name"`
20
+ URL string `json:"url"`
21
+ }
22
+
17
23
APIError struct {
18
24
Code int `json:"code"`
19
25
Message string `json:"message"`
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -3,12 +3,6 @@ package labstack
3
3
import "strconv"
4
4
5
5
type (
6
- Download struct {
7
- ID string `json:"id"`
8
- Name string `json:"name"`
9
- URL string `json:"url"`
10
- }
11
-
12
6
ImageCompressRequest struct {
13
7
File string
14
8
}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments