Skip to content

Commit 2dc2f06

Browse files
Merge pull request #995 from commercetools/gen-sdk-updates
Update generated SDKs
2 parents 34dfa53 + 94b837d commit 2dc2f06

22 files changed

+1038
-4
lines changed

changes.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
**Api changes**
22

3+
<details>
4+
<summary>Added Type(s)</summary>
5+
6+
- added type `DiscountCombinationMode`
7+
- added type `DiscountsConfiguration`
8+
- added type `ProjectSetDiscountsConfigurationAction`
9+
</details>
10+
11+
312
<details>
413
<summary>Removed Property(s)</summary>
514

@@ -10,6 +19,7 @@
1019
<details>
1120
<summary>Added Property(s)</summary>
1221

22+
- added property `discounts` to type `Project`
1323
- added property `skipConfigurationInputDraft` to type `RecurringOrderSetOrderSkipConfigurationAction`
1424
</details>
1525

commercetools/commercetools-graphql-api/src/main/resources/graphql/schema.graphqls

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4563,6 +4563,14 @@ type DiscountedTotalPricePortion {
45634563
discountedAmount: BaseMoney!
45644564
}
45654565

4566+
type DiscountsConfiguration {
4567+
discountCombinationMode: DiscountCombinationMode!
4568+
}
4569+
4570+
input DiscountsConfigurationInput {
4571+
discountCombinationMode: DiscountCombinationMode
4572+
}
4573+
45664574
type EnumAttribute implements Attribute {
45674575
key: String!
45684576
label: String!
@@ -9965,6 +9973,11 @@ type ProductVariantTailoringRemoved implements MessagePayload {
99659973
type: String!
99669974
}
99679975

9976+
enum DiscountCombinationMode {
9977+
Stacking
9978+
BestDeal
9979+
}
9980+
99689981
"Contains information about the limits of your project."
99699982
type ProjectCustomLimitsProjection {
99709983
query: QueryLimitsProjection!
@@ -10006,6 +10019,7 @@ type ProjectProjection {
1000610019
currencies: [Currency!]!
1000710020
shippingRateInputType: ShippingRateInputType
1000810021
createdAt: DateTime!
10022+
discounts: DiscountsConfiguration
1000910023
}
1001010024

1001110025
input ProjectSettingsUpdateAction {
@@ -10032,6 +10046,7 @@ input ProjectSettingsUpdateAction {
1003210046

1003310047
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
1003410048
changeProductSearchIndexingEnabled: ChangeProjectSettingsProductSearchIndexingEnabled
10049+
setDiscountsConfiguration: SetProjectSettingsDiscountsConfiguration
1003510050
}
1003610051

1003710052
input PublishProduct {
@@ -13440,6 +13455,10 @@ input SetProjectSettingsMyBusinessUnitAssociateRoleOnCreation {
1344013455
associateRole: ResourceIdentifierInput
1344113456
}
1344213457

13458+
input SetProjectSettingsDiscountsConfiguration {
13459+
discountsConfiguration: DiscountsConfigurationInput!
13460+
}
13461+
1344313462
input SetProjectSettingsShippingRateInputType {
1344413463
shippingRateInputType: ShippingRateInputTypeInput
1344513464
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
2+
package com.commercetools.api.models.project;
3+
4+
import java.util.Arrays;
5+
import java.util.Optional;
6+
7+
import com.fasterxml.jackson.annotation.JsonCreator;
8+
import com.fasterxml.jackson.annotation.JsonValue;
9+
10+
import io.vrap.rmf.base.client.JsonEnum;
11+
import io.vrap.rmf.base.client.utils.Generated;
12+
13+
/**
14+
* <p>Defines how Product Discounts and Cart Discounts are combined for every Cart in a Project.</p>
15+
*/
16+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
17+
public interface DiscountCombinationMode extends JsonEnum {
18+
19+
/**
20+
<p>Either Product Discounts or Cart Discounts are chosen based on best deal for the customer. Only one type applies per Cart.</p> */
21+
DiscountCombinationMode BEST_DEAL = DiscountCombinationModeEnum.BEST_DEAL;
22+
/**
23+
<p>Product Discounts and Cart Discounts are both applied to the Cart, potentially increasing the total discount.</p> */
24+
DiscountCombinationMode STACKING = DiscountCombinationModeEnum.STACKING;
25+
26+
/**
27+
* possible values of DiscountCombinationMode
28+
*/
29+
enum DiscountCombinationModeEnum implements DiscountCombinationMode {
30+
/**
31+
* BestDeal
32+
*/
33+
BEST_DEAL("BestDeal"),
34+
35+
/**
36+
* Stacking
37+
*/
38+
STACKING("Stacking");
39+
private final String jsonName;
40+
41+
private DiscountCombinationModeEnum(final String jsonName) {
42+
this.jsonName = jsonName;
43+
}
44+
45+
public String getJsonName() {
46+
return jsonName;
47+
}
48+
49+
public String toString() {
50+
return jsonName;
51+
}
52+
}
53+
54+
/**
55+
* the JSON value
56+
* @return json value
57+
*/
58+
@JsonValue
59+
String getJsonName();
60+
61+
/**
62+
* the enum value
63+
* @return name
64+
*/
65+
String name();
66+
67+
/**
68+
* convert value to string
69+
* @return string representation
70+
*/
71+
String toString();
72+
73+
/**
74+
* factory method for a enum value of DiscountCombinationMode
75+
* if no enum has been found an anonymous instance will be created
76+
* @param value the enum value to be wrapped
77+
* @return enum instance
78+
*/
79+
@JsonCreator
80+
public static DiscountCombinationMode findEnum(String value) {
81+
return findEnumViaJsonName(value).orElse(new DiscountCombinationMode() {
82+
@Override
83+
public String getJsonName() {
84+
return value;
85+
}
86+
87+
@Override
88+
public String name() {
89+
return value.toUpperCase();
90+
}
91+
92+
public String toString() {
93+
return value;
94+
}
95+
});
96+
}
97+
98+
/**
99+
* method to find enum using the JSON value
100+
* @param jsonName the json value to be wrapped
101+
* @return optional of enum instance
102+
*/
103+
public static Optional<DiscountCombinationMode> findEnumViaJsonName(String jsonName) {
104+
return Arrays.stream(values()).filter(t -> t.getJsonName().equals(jsonName)).findFirst();
105+
}
106+
107+
/**
108+
* possible enum values
109+
* @return array of possible enum values
110+
*/
111+
public static DiscountCombinationMode[] values() {
112+
return DiscountCombinationModeEnum.values();
113+
}
114+
115+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
2+
package com.commercetools.api.models.project;
3+
4+
import java.time.*;
5+
import java.util.*;
6+
import java.util.function.Function;
7+
8+
import javax.annotation.Nullable;
9+
10+
import com.fasterxml.jackson.annotation.*;
11+
import com.fasterxml.jackson.databind.annotation.*;
12+
13+
import io.vrap.rmf.base.client.utils.Generated;
14+
15+
import jakarta.validation.constraints.NotNull;
16+
17+
/**
18+
* <p>Holds the configuration for behavior of Product and Cart Discounts.</p>
19+
*
20+
* <hr>
21+
* Example to create an instance using the builder pattern
22+
* <div class=code-example>
23+
* <pre><code class='java'>
24+
* DiscountsConfiguration discountsConfiguration = DiscountsConfiguration.builder()
25+
* .discountCombinationMode(DiscountCombinationMode.BEST_DEAL)
26+
* .build()
27+
* </code></pre>
28+
* </div>
29+
*/
30+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
31+
@JsonDeserialize(as = DiscountsConfigurationImpl.class)
32+
public interface DiscountsConfiguration {
33+
34+
/**
35+
* <p>Indicates how Product Discounts and Cart Discounts should be combined. Default value is <code>Stacking</code>.</p>
36+
* @return discountCombinationMode
37+
*/
38+
@NotNull
39+
@JsonProperty("discountCombinationMode")
40+
public DiscountCombinationMode getDiscountCombinationMode();
41+
42+
/**
43+
* <p>Indicates how Product Discounts and Cart Discounts should be combined. Default value is <code>Stacking</code>.</p>
44+
* @param discountCombinationMode value to be set
45+
*/
46+
47+
public void setDiscountCombinationMode(final DiscountCombinationMode discountCombinationMode);
48+
49+
/**
50+
* factory method
51+
* @return instance of DiscountsConfiguration
52+
*/
53+
public static DiscountsConfiguration of() {
54+
return new DiscountsConfigurationImpl();
55+
}
56+
57+
/**
58+
* factory method to create a shallow copy DiscountsConfiguration
59+
* @param template instance to be copied
60+
* @return copy instance
61+
*/
62+
public static DiscountsConfiguration of(final DiscountsConfiguration template) {
63+
DiscountsConfigurationImpl instance = new DiscountsConfigurationImpl();
64+
instance.setDiscountCombinationMode(template.getDiscountCombinationMode());
65+
return instance;
66+
}
67+
68+
public DiscountsConfiguration copyDeep();
69+
70+
/**
71+
* factory method to create a deep copy of DiscountsConfiguration
72+
* @param template instance to be copied
73+
* @return copy instance
74+
*/
75+
@Nullable
76+
public static DiscountsConfiguration deepCopy(@Nullable final DiscountsConfiguration template) {
77+
if (template == null) {
78+
return null;
79+
}
80+
DiscountsConfigurationImpl instance = new DiscountsConfigurationImpl();
81+
instance.setDiscountCombinationMode(template.getDiscountCombinationMode());
82+
return instance;
83+
}
84+
85+
/**
86+
* builder factory method for DiscountsConfiguration
87+
* @return builder
88+
*/
89+
public static DiscountsConfigurationBuilder builder() {
90+
return DiscountsConfigurationBuilder.of();
91+
}
92+
93+
/**
94+
* create builder for DiscountsConfiguration instance
95+
* @param template instance with prefilled values for the builder
96+
* @return builder
97+
*/
98+
public static DiscountsConfigurationBuilder builder(final DiscountsConfiguration template) {
99+
return DiscountsConfigurationBuilder.of(template);
100+
}
101+
102+
/**
103+
* accessor map function
104+
* @param <T> mapped type
105+
* @param helper function to map the object
106+
* @return mapped value
107+
*/
108+
default <T> T withDiscountsConfiguration(Function<DiscountsConfiguration, T> helper) {
109+
return helper.apply(this);
110+
}
111+
112+
/**
113+
* gives a TypeReference for usage with Jackson DataBind
114+
* @return TypeReference
115+
*/
116+
public static com.fasterxml.jackson.core.type.TypeReference<DiscountsConfiguration> typeReference() {
117+
return new com.fasterxml.jackson.core.type.TypeReference<DiscountsConfiguration>() {
118+
@Override
119+
public String toString() {
120+
return "TypeReference<DiscountsConfiguration>";
121+
}
122+
};
123+
}
124+
}

0 commit comments

Comments
 (0)