forked from labd/commercetools-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_api_client.go
63 lines (55 loc) · 1.62 KB
/
service_api_client.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
// Automatically generated, do not edit
package commercetools
import (
"context"
"fmt"
"net/url"
)
// APIClientCreate creates a new instance of type APIClient
func (client *Client) APIClientCreate(ctx context.Context, draft *APIClientDraft, opts ...RequestOption) (result *APIClient, err error) {
params := url.Values{}
for _, opt := range opts {
opt(¶ms)
}
endpoint := "api-clients"
err = client.create(ctx, endpoint, params, draft, &result)
if err != nil {
return nil, err
}
return result, nil
}
// APIClientQuery allows querying for type ApiClient
func (client *Client) APIClientQuery(ctx context.Context, input *QueryInput) (result *APIClientPagedQueryResponse, err error) {
endpoint := "api-clients"
err = client.query(ctx, endpoint, input.toParams(), &result)
if err != nil {
return nil, err
}
return result, nil
}
// APIClientDeleteWithID Delete ApiClient by ID
func (client *Client) APIClientDeleteWithID(ctx context.Context, id string, opts ...RequestOption) (result *APIClient, err error) {
params := url.Values{}
for _, opt := range opts {
opt(¶ms)
}
endpoint := fmt.Sprintf("api-clients/%s", id)
err = client.delete(ctx, endpoint, params, &result)
if err != nil {
return nil, err
}
return result, nil
}
// APIClientGetWithID Get ApiClient by ID
func (client *Client) APIClientGetWithID(ctx context.Context, id string, opts ...RequestOption) (result *APIClient, err error) {
params := url.Values{}
for _, opt := range opts {
opt(¶ms)
}
endpoint := fmt.Sprintf("api-clients/%s", id)
err = client.get(ctx, endpoint, params, &result)
if err != nil {
return nil, err
}
return result, nil
}