-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1cf318
commit f632488
Showing
23 changed files
with
290 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
importapi/client_discount_codes_by_project_key_discount_codes.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package importapi | ||
|
||
// Generated file, please do not change!!! | ||
|
||
type ByProjectKeyDiscountCodesRequestBuilder struct { | ||
projectKey string | ||
client *Client | ||
} | ||
|
||
func (rb *ByProjectKeyDiscountCodesRequestBuilder) ImportContainers() *ByProjectKeyDiscountCodesImportContainersRequestBuilder { | ||
return &ByProjectKeyDiscountCodesImportContainersRequestBuilder{ | ||
projectKey: rb.projectKey, | ||
client: rb.client, | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
importapi/client_import_containers_by_project_key_discount_codes_import_containers.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package importapi | ||
|
||
// Generated file, please do not change!!! | ||
|
||
type ByProjectKeyDiscountCodesImportContainersRequestBuilder struct { | ||
projectKey string | ||
client *Client | ||
} | ||
|
||
func (rb *ByProjectKeyDiscountCodesImportContainersRequestBuilder) WithImportContainerKeyValue(importContainerKey string) *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder { | ||
return &ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder{ | ||
importContainerKey: importContainerKey, | ||
projectKey: rb.projectKey, | ||
client: rb.client, | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...ort_containers_by_project_key_discount_codes_import_containers_by_import_container_key.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package importapi | ||
|
||
// Generated file, please do not change!!! | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
type ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder struct { | ||
projectKey string | ||
importContainerKey string | ||
client *Client | ||
} | ||
|
||
/** | ||
* Creates a request for creating new Discount Codes or updating existing ones. | ||
*/ | ||
func (rb *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestBuilder) Post(body DiscountCodeImportRequest) *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost { | ||
return &ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost{ | ||
body: body, | ||
url: fmt.Sprintf("/%s/discount-codes/import-containers/%s", rb.projectKey, rb.importContainerKey), | ||
client: rb.client, | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...ontainers_by_project_key_discount_codes_import_containers_by_import_container_key_post.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package importapi | ||
|
||
// Generated file, please do not change!!! | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"io/ioutil" | ||
"net/http" | ||
"net/url" | ||
) | ||
|
||
type ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost struct { | ||
body DiscountCodeImportRequest | ||
url string | ||
client *Client | ||
headers http.Header | ||
} | ||
|
||
func (r *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost) Dump() map[string]interface{} { | ||
return map[string]interface{}{ | ||
"url": r.url, | ||
} | ||
} | ||
|
||
func (rb *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost) WithHeaders(headers http.Header) *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost { | ||
rb.headers = headers | ||
return rb | ||
} | ||
|
||
/** | ||
* Creates a request for creating new Discount Codes or updating existing ones. | ||
*/ | ||
func (rb *ByProjectKeyDiscountCodesImportContainersByImportContainerKeyRequestMethodPost) Execute(ctx context.Context) (result *ImportResponse, err error) { | ||
data, err := serializeInput(rb.body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
queryParams := url.Values{} | ||
resp, err := rb.client.post( | ||
ctx, | ||
rb.url, | ||
queryParams, | ||
rb.headers, | ||
data, | ||
) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
content, err := ioutil.ReadAll(resp.Body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer resp.Body.Close() | ||
switch resp.StatusCode { | ||
case 201: | ||
err = json.Unmarshal(content, &result) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return result, nil | ||
case 400: | ||
errorObj := ErrorResponse{} | ||
err = json.Unmarshal(content, &errorObj) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return nil, errorObj | ||
default: | ||
result := GenericRequestError{ | ||
StatusCode: resp.StatusCode, | ||
Content: content, | ||
Response: resp, | ||
} | ||
return nil, result | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.