Skip to content

Commit

Permalink
feat: updated remaining sdks
Browse files Browse the repository at this point in the history
  • Loading branch information
demeyerthom committed Aug 13, 2024
1 parent c1cf318 commit f632488
Show file tree
Hide file tree
Showing 23 changed files with 290 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tasks:
generate-importapi:
cmds:
- task: generate-api
vars: {apiName: importapi, path: importapi}
vars: {apiName: importapi, path: import}

generate-frontend:
cmds:
Expand Down
12 changes: 12 additions & 0 deletions connect/client_deployments_by_project_key_deployments_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (r *ByProjectKeyDeploymentsRequestMethodGet) Dump() map[string]interface{}

type ByProjectKeyDeploymentsRequestMethodGetInput struct {
IntegrationTypes []IntegrationType
DeploymentType *DeploymentType
Limit *int
Offset *int
Sort []string
Expand All @@ -38,6 +39,9 @@ func (input *ByProjectKeyDeploymentsRequestMethodGetInput) Values() url.Values {
for _, v := range input.IntegrationTypes {
values.Add("integrationTypes", fmt.Sprintf("%v", v))
}
if input.DeploymentType != nil {
values.Add("deploymentType", fmt.Sprintf("%v", *input.DeploymentType))
}
if input.Limit != nil {
values.Add("limit", strconv.Itoa(*input.Limit))
}
Expand All @@ -58,6 +62,14 @@ func (rb *ByProjectKeyDeploymentsRequestMethodGet) IntegrationTypes(v []Integrat
return rb
}

func (rb *ByProjectKeyDeploymentsRequestMethodGet) DeploymentType(v DeploymentType) *ByProjectKeyDeploymentsRequestMethodGet {
if rb.params == nil {
rb.params = &ByProjectKeyDeploymentsRequestMethodGetInput{}
}
rb.params.DeploymentType = &v
return rb
}

func (rb *ByProjectKeyDeploymentsRequestMethodGet) Limit(v int) *ByProjectKeyDeploymentsRequestMethodGet {
if rb.params == nil {
rb.params = &ByProjectKeyDeploymentsRequestMethodGetInput{}
Expand Down
21 changes: 16 additions & 5 deletions connect/types_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type ApplicationDeployment struct {
ApplicationName string `json:"applicationName"`
// Contains values of keys that are saved in plain text. Can be accessed after being set.
StandardConfiguration []ConfigurationValue `json:"standardConfiguration"`
// Contains values of secret keys. Cannot be accessed after being set.
// Contains values of secret keys. After being set, these values are encrypted and cannot be accessed.
SecuredConfiguration []ConfigurationValue `json:"securedConfiguration"`
// URL generated after deployment of service applications.
Url *string `json:"url,omitempty"`
Expand Down Expand Up @@ -167,14 +167,14 @@ const (
)

/**
* Reference to a Connector. Either `id` or `key` is required.
* Reference to a [Connector](ctp:connect:type:Connector) or [ConnectorStaged](ctp:connect:type:ConnectorStaged). Either `id` or `key` is required.
*/
type ConnectorReference struct {
// Unique identifier of the referenced Connector.
ID *string `json:"id,omitempty"`
// User-defined unique identifier of the referenced Connector.
Key *string `json:"key,omitempty"`
// If `true`, the previewable [ConnectorStaged](ctp:connect:type:ConnectorStaged) will be referenced instead of the published Connector. The `isPreviewable` field of the [ConnectorStaged](ctp:connect:type:ConnectorStaged) must be `true` to reference a previewable ConnectorStaged.
// If `true`, a previewable [ConnectorStaged](ctp:connect:type:ConnectorStaged) must be referenced in `id` or `key` instead of the published Connector. The `isPreviewable` field of the [ConnectorStaged](ctp:connect:type:ConnectorStaged) must be `true` to reference a previewable ConnectorStaged.
Staged *bool `json:"staged,omitempty"`
// Version of the referenced Connector.
Version *int `json:"version,omitempty"`
Expand Down Expand Up @@ -326,7 +326,7 @@ const (
)

/**
* The host Region of a commercetools Composable Commerce Project. For more information, see [Hosts](hosts-and-authorization#hosts).
* The Region of a commercetools Composable Commerce Project or Deployment. For more information, see [Hosts](/hosts-and-authorization#hosts).
*
*/
type Region string
Expand All @@ -338,7 +338,7 @@ const (
)

/**
* The type of integration provided by a Connector.
* Integration type of the Connector.
*
*/
type IntegrationType string
Expand All @@ -359,6 +359,17 @@ const (
IntegrationTypeOther IntegrationType = "other"
)

/**
* Deployment type of the Connector.
*
*/
type DeploymentType string

const (
DeploymentTypePreview DeploymentType = "preview"
DeploymentTypeProduction DeploymentType = "production"
)

/**
* Details of the GitHub repository that contains the Connect applications.
*
Expand Down
15 changes: 9 additions & 6 deletions connect/types_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Connector struct {
Name string `json:"name"`
// Description of the Connector.
Description *string `json:"description,omitempty"`
// Type of integration provided by the Connector. Can be used to filter search and query results.
// Integration types of the Connector. Can be used to filter search and query results.
IntegrationTypes []IntegrationType `json:"integrationTypes"`
// Owner of the Connector.
Creator Creator `json:"creator"`
Expand Down Expand Up @@ -67,7 +67,7 @@ type ConnectorDraft struct {
Name string `json:"name"`
// Description of the Connector.
Description *string `json:"description,omitempty"`
// Type of integration provided by the Connector. Can be used to filter search and query results.
// Integration types of the Connector. Can be used to filter search and query results.
IntegrationTypes []IntegrationType `json:"integrationTypes"`
// Owner of the Connector.
Creator Creator `json:"creator"`
Expand Down Expand Up @@ -124,7 +124,7 @@ type ConnectorStaged struct {
Name string `json:"name"`
// Description of the Connector.
Description string `json:"description"`
// Type of integration provided by the Connector. Can be used to filter search and query results.
// Integration types of the Connector. Can be used to filter search and query results.
IntegrationTypes []IntegrationType `json:"integrationTypes"`
// Owner of the Connector.
Creator Creator `json:"creator"`
Expand Down Expand Up @@ -675,10 +675,10 @@ func (obj ConnectorAddCertificationCommentAction) MarshalJSON() ([]byte, error)
}

/**
* Requests the previewable status of a ConnectorStaged. A previewable ConnectorStaged can be used in a Deployment for testing and preview purposes.
* Requests the previewable status of a ConnectorStaged. Previewable ConnectorStaged should be deployed for testing and preview purposes. You can only deploy previewable ConnectorStaged to Projects listed in `privateProjects`.
*
* After using this update action, the status of `isPreviewable` will change to `pending`. Following validation, the status of `isPreviewable` will change to `true` if the previewable status is granted, or `false` if it is rejected.
* In the case of a `false` status, contact our [support team](https://commercetools.atlassian.net/servicedesk/customer/portal/27) regarding any issues raised during the validation process.
* In the case of a `false` status, contact the [Connect support team](https://support.commercetools.com/) regarding any issues raised during the validation process.
*
* Requesting the previewable status for a ConnectorStaged that is currently being reviewed returns the [ConnectorStagedPreviewRequestUnderProcess](ctp:connect:type:ConnectorStagedPreviewRequestUnderProcessError) error.
*
Expand All @@ -698,10 +698,13 @@ func (obj ConnectorUpdatePreviewableAction) MarshalJSON() ([]byte, error) {

/**
* Starts the Connector publishing process. You will be unable to update the Connector until the process completes.
*
* `certification` should only be `true` if you want to make the Connector publicly available.
*
*/
type ConnectorPublishAction struct {
// If `true`, the ConnectorStaged enters the certification process. After completing the certification process, the Connector will become publicly available. If `false`, the published Connector becomes private and is available for deployment to Projects listed in `ConnectorStaged.privateProjects`.
// - Set to `false` to make the Connector private and skip the [certification process](/certification). The published Connector will only be deployable on Projects listed in `ConnectorStaged.privateProjects`.
// - Set to `true` to make the Connector public. This will submit the ConnectorStaged to the [certification process](/certification). After completing the certification process, the Connector will become publicly available.
Certification bool `json:"certification"`
}

Expand Down
2 changes: 1 addition & 1 deletion connect/types_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type DeploymentPagedQueryResponse struct {
type DeploymentDraft struct {
// User-defined unique identifier for the Deployment.
Key *string `json:"key,omitempty"`
// Reference to the [Connector](ctp:connect:type:Connector) being deployed.
// Reference to the [Connector](ctp:connect:type:Connector) or [ConnectorStaged](ctp:connect:type:ConnectorStaged) being deployed.
Connector ConnectorReference `json:"connector"`
// Configuration values needed by the [Connector](ctp:connect:type:Connector) for hosting. Keys should match those in the Connector's `configurations` field.
Configurations []DeploymentConfigurationApplication `json:"configurations"`
Expand Down
2 changes: 1 addition & 1 deletion connect/types_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ func (obj FieldValueNotFoundError) Error() string {
/**
* Returned when a server-side problem occurs before or after data persistence. In some cases, the requested action may successfully complete after the error is returned. Therefore, it is recommended to verify the status of the requested resource after receiving a 500 error.
*
* If you encounter this error, report it using the [Support Portal](https://commercetools.atlassian.net/servicedesk/customer/portal/27).
* If you encounter this error, report it to the [Connect support team](https://support.commercetools.com/).
*
*/
type GeneralError struct {
Expand Down
2 changes: 1 addition & 1 deletion history/types_change_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Record struct {
Type string `json:"type"`
// Information about the user or API Client who performed the change.
ModifiedBy ModifiedBy `json:"modifiedBy"`
// Date and time (UTC) when the change was made.
// Date and time (UTC) the change was made.
ModifiedAt string `json:"modifiedAt"`
// Information that describes the resource after the change.
Label Label `json:"label"`
Expand Down
6 changes: 6 additions & 0 deletions importapi/client_by_project_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,9 @@ func (rb *ByProjectKeyRequestBuilder) Types() *ByProjectKeyTypesRequestBuilder {
client: rb.client,
}
}
func (rb *ByProjectKeyRequestBuilder) DiscountCodes() *ByProjectKeyDiscountCodesRequestBuilder {
return &ByProjectKeyDiscountCodesRequestBuilder{
projectKey: rb.projectKey,
client: rb.client,
}
}
15 changes: 15 additions & 0 deletions importapi/client_discount_codes_by_project_key_discount_codes.go
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,
}
}
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,
}
}
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,
}
}
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
}

}
1 change: 1 addition & 0 deletions importapi/types_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ const (
ImportResourceTypeProductVariantPatch ImportResourceType = "product-variant-patch"
ImportResourceTypeStandalonePrice ImportResourceType = "standalone-price"
ImportResourceTypeType ImportResourceType = "type"
ImportResourceTypeDiscountCode ImportResourceType = "discount-code"
)

/**
Expand Down
Loading

0 comments on commit f632488

Please sign in to comment.