Skip to content

Commit 5d015bd

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

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

email.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package labstack
2+
3+
type (
4+
EmailVerifyRequest struct {
5+
Email string `json:"email"`
6+
}
7+
8+
EmailVerifyResponse struct {
9+
Syntax bool `json:"syntax"`
10+
Disposable bool `json:"disposable"`
11+
Domain bool `json:"domain"`
12+
Mailbox bool `json:"mailbox"`
13+
Error string `json:"error"`
14+
}
15+
)
16+
17+
func (c *Client) EmailVerify(req *EmailVerifyRequest) (res *EmailVerifyResponse, err *APIError) {
18+
res = new(EmailVerifyResponse)
19+
_, e := c.resty.R().
20+
SetBody(req).
21+
SetResult(res).
22+
SetError(err).
23+
Post("/email/verify")
24+
if e != nil {
25+
err = new(APIError)
26+
err.Message = e.Error()
27+
}
28+
return
29+
}

text.go

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package labstack
2+
3+
type (
4+
TextSummaryRequest struct {
5+
Text string `json:"text"`
6+
URL string `json:"url"`
7+
Language string `json:"language"`
8+
Length int `json:"length"`
9+
}
10+
11+
TextSummaryResponse struct {
12+
Summary string `json:"summary"`
13+
}
14+
15+
TextSentimentRequest struct {
16+
Text string `json:"text"`
17+
}
18+
19+
TextSentimentResponse struct {
20+
Subjectivity float32 `json:"subjectivity"`
21+
Polarity float32 `json:"polarity"`
22+
}
23+
24+
TextSpellCheckRequest struct {
25+
Text string `json:"text"`
26+
}
27+
28+
TextSpellCheckResponse struct {
29+
Misspelled []*TextSpellCheckMisspelled `json:"misspelled"`
30+
}
31+
32+
TextSpellCheckMisspelled struct {
33+
Word string `json:"word"`
34+
Offset int `json:"offset"`
35+
Suggestions []string `json:"suggestions"`
36+
}
37+
)
38+
39+
func (c *Client) TextSummary(req *TextSummaryRequest) (res *TextSummaryResponse, err *APIError) {
40+
res = new(TextSummaryResponse)
41+
_, e := c.resty.R().
42+
SetBody(req).
43+
SetResult(res).
44+
SetError(err).
45+
Post("/text/summary")
46+
if e != nil {
47+
err = new(APIError)
48+
err.Message = e.Error()
49+
}
50+
return
51+
}
52+
53+
func (c *Client) TextSentiment(req *TextSentimentRequest) (res *TextSentimentResponse, err *APIError) {
54+
res = new(TextSentimentResponse)
55+
_, e := c.resty.R().
56+
SetBody(req).
57+
SetResult(res).
58+
SetError(err).
59+
Post("/text/sentiment")
60+
if e != nil {
61+
err = new(APIError)
62+
err.Message = e.Error()
63+
}
64+
return
65+
}
66+
67+
func (c *Client) TextSpellCheck(req *TextSpellCheckRequest) (res *TextSpellCheckResponse, err *APIError) {
68+
res = new(TextSpellCheckResponse)
69+
_, e := c.resty.R().
70+
SetBody(req).
71+
SetResult(res).
72+
SetError(err).
73+
Post("/text/spell-check")
74+
if e != nil {
75+
err = new(APIError)
76+
err.Message = e.Error()
77+
}
78+
return
79+
}

0 commit comments

Comments
 (0)