forked from MEDIGO/go-zendesk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocale.go
36 lines (31 loc) · 991 Bytes
/
locale.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
package zendesk
import (
"fmt"
"time"
)
// Locale represents an Zendesk translation locale.
//
// Zendesk Core API docs: https://developer.zendesk.com/rest_api/docs/core/locales
type Locale struct {
ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
Locale *string `json:"locale,omitempty"`
Name *string `json:"name,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
func (c *client) ListLocales() ([]Locale, error) {
out := new(APIPayload)
err := c.get("/api/v2/locales.json", out)
return out.Locales, err
}
func (c *client) ShowLocale(id int64) (*Locale, error) {
out := new(APIPayload)
err := c.get(fmt.Sprintf("/api/v2/locales/%d.json", id), out)
return out.Locale, err
}
func (c *client) ShowLocaleByCode(code string) (*Locale, error) {
out := new(APIPayload)
err := c.get(fmt.Sprintf("/api/v2/locales/%s.json", code), out)
return out.Locale, err
}