forked from lokalise/go-lokalise-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svc_translationprovider.go
68 lines (55 loc) · 2.68 KB
/
svc_translationprovider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package lokalise
import "fmt"
const (
pathTranslationProviders = "translation_providers"
)
type TranslationProviderService struct {
BaseService
}
type TranslationProvider struct {
ProviderID int64 `json:"provider_id"`
Name string `json:"name"`
Slug string `json:"slug"`
PricePairMin string `json:"price_pair_min"`
WebsiteURL string `json:"website_url,omitempty"`
Description string `json:"description,omitempty"`
Tiers []TranslationTier `json:"tiers,omitempty"`
Pairs []TranslationPair `json:"pairs"`
}
type TranslationTier struct {
TierID int64 `json:"tier_id"`
Title string `json:"title"`
}
type TranslationPair struct {
TierID int64 `json:"tier_id"`
FromLangISO string `json:"from_lang_iso"`
FromLangName string `json:"from_lang_name"`
ToLangISO string `json:"to_lang_iso"`
ToLangName string `json:"to_lang_name"`
PricePerWord string `json:"price_per_word"`
}
// ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Service request/response objects
// _____________________________________________________________________________________________________________________
type TranslationProvidersResponse struct {
Paged
TranslationProviders []TranslationProvider `json:"translation_providers"`
}
// ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
// Service methods
// _____________________________________________________________________________________________________________________
func (c *TranslationProviderService) List(teamID int64) (r TranslationProvidersResponse, err error) {
resp, err := c.getWithOptions(c.Ctx(), fmt.Sprintf("%s/%d/%s", pathTeams, teamID, pathTranslationProviders), &r, c.PageOpts())
if err != nil {
return
}
applyPaged(resp, &r.Paged)
return r, apiError(resp)
}
func (c *TranslationProviderService) Retrieve(teamID, providerID int64) (r TranslationProvider, err error) {
resp, err := c.get(c.Ctx(), fmt.Sprintf("%s/%d/%s/%d", pathTeams, teamID, "translation_providers", providerID), &r)
if err != nil {
return
}
return r, apiError(resp)
}