-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproduct_info_list.go
68 lines (52 loc) · 1.74 KB
/
product_info_list.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 multivers
// https://api.online.unit4.nl/V14/Help/Api/GET-api-database-ProductInfoList_productId_shortName_description_productGroupId
import (
"context"
"net/url"
"github.com/gorilla/schema"
)
const (
ProductInfoListPath = "/ProductInfoList"
)
func NewProductInfoListService(client *Client) *ProductInfoListService {
return &ProductInfoListService{Client: client}
}
type ProductInfoListService struct {
Client *Client
}
func (s *ProductInfoListService) Get(database string, requestParams *ProductInfoListGetParams, ctx context.Context) (*ProductInfoListGetResponse, error) {
method := "GET"
responseBody := NewProductInfoListGetResponse()
path := apiPrefix + ProductInfoListPath + ".json"
// Process path parameters
if database != "" {
path = apiPrefix + "/" + database + ProductInfoListPath + ".json"
}
// create a new HTTP request
httpReq, err := s.Client.NewRequest(ctx, method, path, nil)
if err != nil {
return nil, err
}
// Process query parameters
addQueryParamsToRequest(requestParams, httpReq, false)
// submit the request
_, err = s.Client.Do(httpReq, responseBody)
return responseBody, err
}
func NewProductInfoListGetParams() *ProductInfoListGetParams {
return &ProductInfoListGetParams{}
}
type ProductInfoListGetParams struct {
ProductID string `schema:"productId"`
ShortName string `schema:"shortName"`
Description string `schema:"description"`
ProductGroupID string `schema:"productGroupId"`
}
func (p *ProductInfoListGetParams) FromQueryParams(queryParams url.Values) error {
decoder := schema.NewDecoder()
return decoder.Decode(p, queryParams)
}
func NewProductInfoListGetResponse() *ProductInfoListGetResponse {
return &ProductInfoListGetResponse{}
}
type ProductInfoListGetResponse []ProductInfo