diff --git a/Taskfile.yaml b/Taskfile.yaml index 2829cf26..d00a459f 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -46,7 +46,7 @@ tasks: generate-importapi: cmds: - task: generate-api - vars: {apiName: importapi, path: importapi} + vars: {apiName: importapi, path: import} generate-frontend: cmds: diff --git a/connect/client_deployments_by_project_key_deployments_get.go b/connect/client_deployments_by_project_key_deployments_get.go index ca0f3968..32167d18 100644 --- a/connect/client_deployments_by_project_key_deployments_get.go +++ b/connect/client_deployments_by_project_key_deployments_get.go @@ -28,6 +28,7 @@ func (r *ByProjectKeyDeploymentsRequestMethodGet) Dump() map[string]interface{} type ByProjectKeyDeploymentsRequestMethodGetInput struct { IntegrationTypes []IntegrationType + DeploymentType *DeploymentType Limit *int Offset *int Sort []string @@ -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)) } @@ -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{} diff --git a/connect/types_common.go b/connect/types_common.go index 8acc292f..22ab31dd 100644 --- a/connect/types_common.go +++ b/connect/types_common.go @@ -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"` @@ -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"` @@ -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 @@ -338,7 +338,7 @@ const ( ) /** -* The type of integration provided by a Connector. +* Integration type of the Connector. * */ type IntegrationType string @@ -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. * diff --git a/connect/types_connector.go b/connect/types_connector.go index ed53f1ef..b63df40d 100644 --- a/connect/types_connector.go +++ b/connect/types_connector.go @@ -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"` @@ -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"` @@ -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"` @@ -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. * @@ -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"` } diff --git a/connect/types_deployment.go b/connect/types_deployment.go index 3c9ce98d..66a56e44 100644 --- a/connect/types_deployment.go +++ b/connect/types_deployment.go @@ -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"` diff --git a/connect/types_error.go b/connect/types_error.go index 97ecd910..e8308158 100644 --- a/connect/types_error.go +++ b/connect/types_error.go @@ -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 { diff --git a/history/types_change_history.go b/history/types_change_history.go index c6b459c7..e2f5f90b 100644 --- a/history/types_change_history.go +++ b/history/types_change_history.go @@ -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"` diff --git a/importapi/client_by_project_key.go b/importapi/client_by_project_key.go index f231f3f5..184be681 100644 --- a/importapi/client_by_project_key.go +++ b/importapi/client_by_project_key.go @@ -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, + } +} diff --git a/importapi/client_discount_codes_by_project_key_discount_codes.go b/importapi/client_discount_codes_by_project_key_discount_codes.go new file mode 100644 index 00000000..8b1b9723 --- /dev/null +++ b/importapi/client_discount_codes_by_project_key_discount_codes.go @@ -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, + } +} diff --git a/importapi/client_import_containers_by_project_key_discount_codes_import_containers.go b/importapi/client_import_containers_by_project_key_discount_codes_import_containers.go new file mode 100644 index 00000000..7725c05e --- /dev/null +++ b/importapi/client_import_containers_by_project_key_discount_codes_import_containers.go @@ -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, + } +} diff --git a/importapi/client_import_containers_by_project_key_discount_codes_import_containers_by_import_container_key.go b/importapi/client_import_containers_by_project_key_discount_codes_import_containers_by_import_container_key.go new file mode 100644 index 00000000..ff95b717 --- /dev/null +++ b/importapi/client_import_containers_by_project_key_discount_codes_import_containers_by_import_container_key.go @@ -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, + } +} diff --git a/importapi/client_import_containers_by_project_key_discount_codes_import_containers_by_import_container_key_post.go b/importapi/client_import_containers_by_project_key_discount_codes_import_containers_by_import_container_key_post.go new file mode 100644 index 00000000..db5f40fe --- /dev/null +++ b/importapi/client_import_containers_by_project_key_discount_codes_import_containers_by_import_container_key_post.go @@ -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 + } + +} diff --git a/importapi/types_common.go b/importapi/types_common.go index 31887532..27fb6707 100644 --- a/importapi/types_common.go +++ b/importapi/types_common.go @@ -764,6 +764,7 @@ const ( ImportResourceTypeProductVariantPatch ImportResourceType = "product-variant-patch" ImportResourceTypeStandalonePrice ImportResourceType = "standalone-price" ImportResourceTypeType ImportResourceType = "type" + ImportResourceTypeDiscountCode ImportResourceType = "discount-code" ) /** diff --git a/importapi/types_discount_codes.go b/importapi/types_discount_codes.go new file mode 100644 index 00000000..751ec04e --- /dev/null +++ b/importapi/types_discount_codes.go @@ -0,0 +1,65 @@ +package importapi + +// Generated file, please do not change!!! + +import ( + "encoding/json" + "time" +) + +/** +* The data representation for a Discount Code to be imported that is persisted as a [Discount Code](/../api/projects/discountCodes#discountcode) in the Project. +* + */ +type DiscountCodeImport struct { + // User-defined unique identifier. If a [Discount Code](/../api/projects/discountCodes#discountcode) with this `key` exists, it will be updated with the imported data. + Key string `json:"key"` + // Maps to `DiscountCode.name`. + Name *LocalizedString `json:"name,omitempty"` + // Maps to `DiscountCode.description`. + Description *LocalizedString `json:"description,omitempty"` + // User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount. + Code string `json:"code"` + // Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied. + CartDiscounts []CartDiscountKeyReference `json:"cartDiscounts"` + // DiscountCode can only be applied to Carts that match this predicate. + CartPredicate *string `json:"cartPredicate,omitempty"` + // Indicates if the DiscountCode is active and can be applied to the Cart. + IsActive bool `json:"isActive"` + // Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or update. However, Order cancellation or deletion does not decrement the count. + MaxApplications *int `json:"maxApplications,omitempty"` + // Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or update. However, Order cancellation or deletion does not decrement the count. + MaxApplicationsPerCustomer *int `json:"maxApplicationsPerCustomer,omitempty"` + // Groups to which the DiscountCode belongs. + Groups []string `json:"groups"` + // Date and time (UTC) from which the DiscountCode is effective. + ValidFrom *time.Time `json:"validFrom,omitempty"` + // Date and time (UTC) until which the DiscountCode is effective. + ValidUntil *time.Time `json:"validUntil,omitempty"` + // Custom Fields of the DiscountCode. + Custom *Custom `json:"custom,omitempty"` +} + +// MarshalJSON override to set the discriminator value or remove +// optional nil slices +func (obj DiscountCodeImport) MarshalJSON() ([]byte, error) { + type Alias DiscountCodeImport + data, err := json.Marshal(struct { + *Alias + }{Alias: (*Alias)(&obj)}) + if err != nil { + return nil, err + } + + raw := make(map[string]interface{}) + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + if raw["groups"] == nil { + delete(raw, "groups") + } + + return json.Marshal(raw) + +} diff --git a/importapi/types_errors.go b/importapi/types_errors.go index c7b46d6b..b83793f1 100644 --- a/importapi/types_errors.go +++ b/importapi/types_errors.go @@ -12,7 +12,7 @@ import ( * */ type ErrorResponse struct { - // The http status code of the response. + // The HTTP status code of the response. StatusCode int `json:"statusCode"` // Describes the error. Message string `json:"message"` diff --git a/importapi/types_importrequests.go b/importapi/types_importrequests.go index eafbaf18..b15f610e 100644 --- a/importapi/types_importrequests.go +++ b/importapi/types_importrequests.go @@ -103,6 +103,12 @@ func mapDiscriminatorImportRequest(input interface{}) (ImportRequest, error) { return nil, err } return obj, nil + case "discount-code": + obj := DiscountCodeImportRequest{} + if err := decodeStruct(input, &obj); err != nil { + return nil, err + } + return obj, nil } return nil, nil } @@ -212,7 +218,7 @@ func (obj ProductVariantImportRequest) MarshalJSON() ([]byte, error) { } /** -* The request body to [import Embedded Prices](#import-embedded-prices). Contains data for [Embedded Prices](/../api/projects/products#embedded-price) to be created or updated in a Project. +* The request body to [import Embedded Prices](#import-embedded-prices). Contains data for [Embedded Prices](/../api/types#price) to be created or updated in a Project. * */ type PriceImportRequest struct { @@ -362,3 +368,22 @@ func (obj TypeImportRequest) MarshalJSON() ([]byte, error) { *Alias }{Action: "type", Alias: (*Alias)(&obj)}) } + +/** +* The request body to [import Discount Codes](#import-discount-codes). Contains data for [Discount Codes](/../api/projects/discountCodes#discountcode) to be created or updated in a Project. +* + */ +type DiscountCodeImportRequest struct { + // The Discount Code import resources of this request. + Resources []DiscountCodeImport `json:"resources"` +} + +// MarshalJSON override to set the discriminator value or remove +// optional nil slices +func (obj DiscountCodeImportRequest) MarshalJSON() ([]byte, error) { + type Alias DiscountCodeImportRequest + return json.Marshal(struct { + Action string `json:"type"` + *Alias + }{Action: "discount-code", Alias: (*Alias)(&obj)}) +} diff --git a/importapi/types_orders.go b/importapi/types_orders.go index 0982a0e1..9b673bd2 100644 --- a/importapi/types_orders.go +++ b/importapi/types_orders.go @@ -854,7 +854,7 @@ func (obj ScoreShippingRateInput) MarshalJSON() ([]byte, error) { * The data representation for an Order to be imported that is persisted as an [Order](/../api/projects/orders#top) in the Project. * * In commercetools, you can import an Order using the -* [Create Order by Import](ctp:importapi:endpoint:/{projectKey}/orders/import:POST) +* [Create Order by Import](ctp:import:endpoint:/{projectKey}/orders/import:POST) * endpoint method instead of creating it from a Cart. * * An OrderImport is a snapshot of an order at the time it was imported. diff --git a/importapi/types_prices.go b/importapi/types_prices.go index ea84c293..04b0a641 100644 --- a/importapi/types_prices.go +++ b/importapi/types_prices.go @@ -70,17 +70,20 @@ type PriceImport struct { Channel *ChannelKeyReference `json:"channel,omitempty"` // Sets a discounted price from an external service. Discounted *DiscountedPrice `json:"discounted,omitempty"` - // Only the [Embedded Price](/../api/projects/products#embedded-price) updates will be published to `staged` and `current` projection. + // Only the [Embedded Price](/../api/types#price) updates will be published to `staged` and `current` projection. Publish *bool `json:"publish,omitempty"` + // - Set to `false` to update both the [current and staged projections](/../api/projects/productProjections#current--staged) of the [Product](/../api/projects/products#product) with the new Price data. + // - Leave empty or set to `true` to only update the staged projection. + Staged *bool `json:"staged,omitempty"` // The tiered prices for this price. Tiers []PriceTier `json:"tiers"` // The custom fields for this price. Custom *Custom `json:"custom,omitempty"` - // The ProductVariant in which this [Embedded Price](/../api/projects/products#embedded-price) is contained. + // The ProductVariant in which this [Embedded Price](/../api/types#price) is contained. // The Reference to the [ProductVariant](/../api/projects/products#productvariant) with which the [Price](/../api/types#price) is associated. // If referenced ProductVariant does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary ProductVariant is created. ProductVariant ProductVariantKeyReference `json:"productVariant"` - // The Product in which the Product Variant containing this [Embedded Price](/../api/projects/products#embedded-price) is contained. Maps to `ProductVariant.product`. + // The Product in which the Product Variant containing this [Embedded Price](/../api/types#price) is contained. Maps to `ProductVariant.product`. // The Reference to the [Product](/../api/projects/products#product) with which the [Price](/../api/types#price) is associated. // If referenced Product does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary Product is created. Product ProductKeyReference `json:"product"` diff --git a/importapi/types_productdrafts.go b/importapi/types_productdrafts.go index c9905bfe..564ecf3c 100644 --- a/importapi/types_productdrafts.go +++ b/importapi/types_productdrafts.go @@ -82,9 +82,7 @@ type ProductDraftImport struct { // The Reference to the [State](/../api/projects/states#state) with which the ProductDraft is associated. // If referenced State does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary State is created. State *StateKeyReference `json:"state,omitempty"` - // If `publish` is set to either `true` or `false`, both staged and current projections are set to the same value provided by the import data. - // If `publish` is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. - // However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether `publish` is set or not. + // Determines the published status and current/staged projection of the Product. For more information, see [Managing the published state of Products](/best-practices#managing-the-published-state-of-products). Publish *bool `json:"publish,omitempty"` // Determines the type of Prices the API uses. See [ProductPriceMode](/../api/projects/products#productpricemode) for more details. If not provided, the existing `Product.priceMode` is not changed. PriceMode *ProductPriceModeEnum `json:"priceMode,omitempty"` diff --git a/importapi/types_products.go b/importapi/types_products.go index 9fdfb312..788d8e4e 100644 --- a/importapi/types_products.go +++ b/importapi/types_products.go @@ -31,7 +31,7 @@ import ( type SearchKeywords map[string][]SearchKeyword type SearchKeyword struct { Text string `json:"text"` - // The tokenizer defines the tokens that are used to match against the [Suggest Query](/../products-suggestions#suggest-query) input. + // The tokenizer defines the tokens that are used to match against the [Suggest Query](/../products-suggestions#query-suggestions) input. SuggestTokenizer SuggestTokenizer `json:"suggestTokenizer,omitempty"` } @@ -54,7 +54,7 @@ func (obj *SearchKeyword) UnmarshalJSON(data []byte) error { } /** -* The tokenizer defines the tokens that are used to match against the [Suggest Query](/../products-suggestions#suggest-query) input. +* The tokenizer defines the tokens that are used to match against the [Suggest Query](/../products-suggestions#query-suggestions) input. * */ type SuggestTokenizer interface{} @@ -188,9 +188,7 @@ type ProductImport struct { // The Reference to the [State](/../api/projects/states#state) with which the Product is associated. // If referenced State does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary State is created. State *StateKeyReference `json:"state,omitempty"` - // If `publish` is set to either `true` or `false`, both staged and current projections are set to the same value provided by the import data. - // If `publish` is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. - // However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether `publish` is set or not. + // Determines the published status and current/staged projection of the Product. For more information, see [Managing the published state of Products](/best-practices#managing-the-published-state-of-products). Publish *bool `json:"publish,omitempty"` // Determines the type of Prices the API uses. See [ProductPriceMode](/../api/projects/products#productpricemode) for more details. If not provided, the existing `Product.priceMode` is not changed. PriceMode *ProductPriceModeEnum `json:"priceMode,omitempty"` diff --git a/importapi/types_productvariants.go b/importapi/types_productvariants.go index b2fd8714..69eb196e 100644 --- a/importapi/types_productvariants.go +++ b/importapi/types_productvariants.go @@ -781,6 +781,9 @@ type ProductVariantImport struct { // If `publish` is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. // However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether `publish` is set or not. Publish *bool `json:"publish,omitempty"` + // - Set to `false` to update both the [current and staged projections](/../api/projects/productProjections#current--staged) of the [Product](/../api/projects/products#product) with the new Product Variant data. + // - Leave empty or set to `true` to only update the staged projection. + Staged *bool `json:"staged,omitempty"` // The [Product](/../api/projects/products#productvariant) to which this Product Variant belongs. Maps to `ProductVariant.product`. // The Reference to the [Product](/../api/projects/products#product) with which the ProductVariant is associated. // If referenced Product does not exist, the `state` of the [ImportOperation](/import-operation#importoperation) will be set to `unresolved` until the necessary Product is created. diff --git a/importapi/types_types.go b/importapi/types_types.go index 3b14c147..3c4fe5b0 100644 --- a/importapi/types_types.go +++ b/importapi/types_types.go @@ -336,6 +336,7 @@ const ( CustomFieldReferenceValueCategory CustomFieldReferenceValue = "category" CustomFieldReferenceValueChannel CustomFieldReferenceValue = "channel" CustomFieldReferenceValueCustomer CustomFieldReferenceValue = "customer" + CustomFieldReferenceValueCustomerGroup CustomFieldReferenceValue = "customer-group" CustomFieldReferenceValueKeyValueDocument CustomFieldReferenceValue = "key-value-document" CustomFieldReferenceValueOrder CustomFieldReferenceValue = "order" CustomFieldReferenceValueProduct CustomFieldReferenceValue = "product" diff --git a/platform/types_business_unit.go b/platform/types_business_unit.go index 2d89d806..a27ca6c2 100644 --- a/platform/types_business_unit.go +++ b/platform/types_business_unit.go @@ -114,8 +114,7 @@ const ( * Generic type to model the fields that all types of Business Units have in common. * */ -type BusinessUnit interface { -} +type BusinessUnit interface{} func mapDiscriminatorBusinessUnit(input interface{}) (BusinessUnit, error) { var discriminator string @@ -566,7 +565,6 @@ func mapDiscriminatorBusinessUnitUpdateAction(input interface{}) (BusinessUnitUp type Company struct { // Unique identifier of the Business Unit. ID string `json:"id"` - // Current version of the Business Unit. Version int `json:"version"` // Date and time (UTC) the Business Unit was initially created. @@ -753,7 +751,6 @@ func (obj CompanyDraft) MarshalJSON() ([]byte, error) { type Division struct { // Unique identifier of the Business Unit. ID string `json:"id"` - // Current version of the Business Unit. Version int `json:"version"` // Date and time (UTC) the Business Unit was initially created.