* | :heavy_minus_sign: | The ID of the merchant account to use for this request. |
+| `giftCardActivationCreate` | [GiftCardActivationCreate](../../models/components/GiftCardActivationCreate.md) | :heavy_check_mark: | N/A |
+
+### Response
+
+**[ActivateGiftCardResponse](../../models/operations/ActivateGiftCardResponse.md)**
+
+### Errors
+
+| Error Type | Status Code | Content Type |
+| --------------------------------- | --------------------------------- | --------------------------------- |
+| models/errors/Error400 | 400 | application/json |
+| models/errors/Error401 | 401 | application/json |
+| models/errors/Error403 | 403 | application/json |
+| models/errors/Error404 | 404 | application/json |
+| models/errors/Error405 | 405 | application/json |
+| models/errors/Error409 | 409 | application/json |
+| models/errors/HTTPValidationError | 422 | application/json |
+| models/errors/Error425 | 425 | application/json |
+| models/errors/Error429 | 429 | application/json |
+| models/errors/Error500 | 500 | application/json |
+| models/errors/Error502 | 502 | application/json |
+| models/errors/Error504 | 504 | application/json |
+| models/errors/APIException | 4XX, 5XX | \*/\* |
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 5791823b..c4e8e801 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
groupId=com.gr4vy
artifactId=sdk
-version=2.16.116
+version=2.16.117
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
diff --git a/src/main/java/com/gr4vy/sdk/Activations.java b/src/main/java/com/gr4vy/sdk/Activations.java
new file mode 100644
index 00000000..f8d575ae
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/Activations.java
@@ -0,0 +1,87 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk;
+
+import static com.gr4vy.sdk.operations.Operations.RequestOperation;
+
+import com.gr4vy.sdk.models.components.GiftCardActivationCreate;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardRequest;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardRequestBuilder;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardResponse;
+import com.gr4vy.sdk.operations.ActivateGiftCard;
+import com.gr4vy.sdk.utils.Headers;
+import java.lang.String;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+
+public class Activations {
+ private static final Headers _headers = Headers.EMPTY;
+ private final SDKConfiguration sdkConfiguration;
+ private final AsyncActivations asyncSDK;
+
+ Activations(SDKConfiguration sdkConfiguration) {
+ this.sdkConfiguration = sdkConfiguration;
+ this.asyncSDK = new AsyncActivations(this, sdkConfiguration);
+ }
+
+ /**
+ * Switches to the async SDK.
+ *
+ * @return The async SDK
+ */
+ public AsyncActivations async() {
+ return asyncSDK;
+ }
+
+ /**
+ * Activate a gift card
+ *
+ * Activate a physical gift card through the primary gift card service.
+ *
+ * @return The call builder
+ */
+ public ActivateGiftCardRequestBuilder create() {
+ return new ActivateGiftCardRequestBuilder(sdkConfiguration);
+ }
+
+ /**
+ * Activate a gift card
+ *
+ *
Activate a physical gift card through the primary gift card service.
+ *
+ * @param giftCardActivationCreate The details used to activate a physical gift card.
+ * @return The response from the API call
+ * @throws RuntimeException subclass if the API call fails
+ */
+ public ActivateGiftCardResponse create(GiftCardActivationCreate giftCardActivationCreate) {
+ return create(JsonNullable.undefined(), JsonNullable.undefined(), giftCardActivationCreate);
+ }
+
+ /**
+ * Activate a gift card
+ *
+ *
Activate a physical gift card through the primary gift card service.
+ *
+ * @param idempotencyKey A unique key that identifies this request. If supported by the gift card service, the value will be forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.
+ * @param merchantAccountId
+ * @param giftCardActivationCreate The details used to activate a physical gift card.
+ * @return The response from the API call
+ * @throws RuntimeException subclass if the API call fails
+ */
+ public ActivateGiftCardResponse create(
+ JsonNullable idempotencyKey, JsonNullable merchantAccountId,
+ GiftCardActivationCreate giftCardActivationCreate) {
+ ActivateGiftCardRequest request =
+ ActivateGiftCardRequest
+ .builder()
+ .idempotencyKey(idempotencyKey)
+ .merchantAccountId(merchantAccountId)
+ .giftCardActivationCreate(giftCardActivationCreate)
+ .build();
+ RequestOperation operation
+ = new ActivateGiftCard.Sync(sdkConfiguration, _headers);
+ return operation.handleResponse(operation.doRequest(request));
+ }
+
+}
diff --git a/src/main/java/com/gr4vy/sdk/AsyncActivations.java b/src/main/java/com/gr4vy/sdk/AsyncActivations.java
new file mode 100644
index 00000000..fd9f0372
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/AsyncActivations.java
@@ -0,0 +1,88 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk;
+
+import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation;
+
+import com.gr4vy.sdk.models.components.GiftCardActivationCreate;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardRequest;
+import com.gr4vy.sdk.models.operations.async.ActivateGiftCardRequestBuilder;
+import com.gr4vy.sdk.models.operations.async.ActivateGiftCardResponse;
+import com.gr4vy.sdk.operations.ActivateGiftCard;
+import com.gr4vy.sdk.utils.Headers;
+import java.lang.String;
+import java.util.concurrent.CompletableFuture;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+
+public class AsyncActivations {
+ private static final Headers _headers = Headers.EMPTY;
+ private final SDKConfiguration sdkConfiguration;
+ private final Activations syncSDK;
+
+ AsyncActivations(Activations syncSDK, SDKConfiguration sdkConfiguration) {
+ this.sdkConfiguration = sdkConfiguration;
+ this.syncSDK = syncSDK;
+ }
+
+ /**
+ * Switches to the sync SDK.
+ *
+ * @return The sync SDK
+ */
+ public Activations sync() {
+ return syncSDK;
+ }
+
+
+ /**
+ * Activate a gift card
+ *
+ * Activate a physical gift card through the primary gift card service.
+ *
+ * @return The async call builder
+ */
+ public ActivateGiftCardRequestBuilder create() {
+ return new ActivateGiftCardRequestBuilder(sdkConfiguration);
+ }
+
+ /**
+ * Activate a gift card
+ *
+ *
Activate a physical gift card through the primary gift card service.
+ *
+ * @param giftCardActivationCreate The details used to activate a physical gift card.
+ * @return {@code CompletableFuture} - The async response
+ */
+ public CompletableFuture create(GiftCardActivationCreate giftCardActivationCreate) {
+ return create(JsonNullable.undefined(), JsonNullable.undefined(), giftCardActivationCreate);
+ }
+
+ /**
+ * Activate a gift card
+ *
+ * Activate a physical gift card through the primary gift card service.
+ *
+ * @param idempotencyKey A unique key that identifies this request. If supported by the gift card service, the value will be forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.
+ * @param merchantAccountId
+ * @param giftCardActivationCreate The details used to activate a physical gift card.
+ * @return {@code CompletableFuture} - The async response
+ */
+ public CompletableFuture create(
+ JsonNullable idempotencyKey, JsonNullable merchantAccountId,
+ GiftCardActivationCreate giftCardActivationCreate) {
+ ActivateGiftCardRequest request =
+ ActivateGiftCardRequest
+ .builder()
+ .idempotencyKey(idempotencyKey)
+ .merchantAccountId(merchantAccountId)
+ .giftCardActivationCreate(giftCardActivationCreate)
+ .build();
+ AsyncRequestOperation operation
+ = new ActivateGiftCard.Async(sdkConfiguration, _headers);
+ return operation.doRequest(request)
+ .thenCompose(operation::handleResponse);
+ }
+
+}
diff --git a/src/main/java/com/gr4vy/sdk/AsyncGiftCards.java b/src/main/java/com/gr4vy/sdk/AsyncGiftCards.java
index 16225a13..ddacc9ff 100644
--- a/src/main/java/com/gr4vy/sdk/AsyncGiftCards.java
+++ b/src/main/java/com/gr4vy/sdk/AsyncGiftCards.java
@@ -34,11 +34,13 @@ public class AsyncGiftCards {
private static final Headers _headers = Headers.EMPTY;
private final SDKConfiguration sdkConfiguration;
private final AsyncBalances balances;
+ private final AsyncActivations activations;
private final GiftCards syncSDK;
AsyncGiftCards(GiftCards syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.balances = new AsyncBalances(syncSDK.balances(), this.sdkConfiguration);
+ this.activations = new AsyncActivations(syncSDK.activations(), this.sdkConfiguration);
this.syncSDK = syncSDK;
}
@@ -46,6 +48,10 @@ public final AsyncBalances balances() {
return balances;
}
+ public final AsyncActivations activations() {
+ return activations;
+ }
+
/**
* Switches to the sync SDK.
*
diff --git a/src/main/java/com/gr4vy/sdk/GiftCards.java b/src/main/java/com/gr4vy/sdk/GiftCards.java
index c0bd05b6..19ac3468 100644
--- a/src/main/java/com/gr4vy/sdk/GiftCards.java
+++ b/src/main/java/com/gr4vy/sdk/GiftCards.java
@@ -34,10 +34,12 @@ public class GiftCards {
private final SDKConfiguration sdkConfiguration;
private final AsyncGiftCards asyncSDK;
private final Balances balances;
+ private final Activations activations;
GiftCards(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.balances = new Balances(this.sdkConfiguration);
+ this.activations = new Activations(this.sdkConfiguration);
this.asyncSDK = new AsyncGiftCards(this, sdkConfiguration);
}
@@ -45,6 +47,10 @@ public final Balances balances() {
return balances;
}
+ public final Activations activations() {
+ return activations;
+ }
+
/**
* Switches to the async SDK.
*
diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
index f8cef020..b5cb428a 100644
--- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
+++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java
@@ -22,7 +22,7 @@ public class SDKConfiguration {
private static final String LANGUAGE = "java";
public static final String OPENAPI_DOC_VERSION = "1.0.0";
- public static final String SDK_VERSION = "2.16.116";
+ public static final String SDK_VERSION = "2.16.117";
public static final String GEN_VERSION = "2.918.4";
private static final String BASE_PACKAGE = "com.gr4vy.sdk";
public static final String USER_AGENT =
diff --git a/src/main/java/com/gr4vy/sdk/models/components/GiftCardActivationCreate.java b/src/main/java/com/gr4vy/sdk/models/components/GiftCardActivationCreate.java
new file mode 100644
index 00000000..14f65504
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/components/GiftCardActivationCreate.java
@@ -0,0 +1,359 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.components;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+/**
+ * GiftCardActivationCreate
+ *
+ * The details used to activate a physical gift card.
+ */
+public class GiftCardActivationCreate {
+ /**
+ * The 16-19 digit number for the gift card.
+ */
+ @JsonProperty("number")
+ private String number;
+
+ /**
+ * The PIN for this gift card.
+ */
+ @JsonInclude(Include.NON_ABSENT)
+ @JsonProperty("pin")
+ private JsonNullable pin;
+
+ /**
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if
+ * `currency` is provided.
+ */
+ @JsonInclude(Include.NON_ABSENT)
+ @JsonProperty("amount")
+ private JsonNullable amount;
+
+ /**
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
+ */
+ @JsonInclude(Include.NON_ABSENT)
+ @JsonProperty("currency")
+ private JsonNullable currency;
+
+ /**
+ * An optional external identifier for this activation.
+ */
+ @JsonInclude(Include.NON_ABSENT)
+ @JsonProperty("external_identifier")
+ private JsonNullable externalIdentifier;
+
+ @JsonCreator
+ public GiftCardActivationCreate(
+ @JsonProperty("number") String number,
+ @JsonProperty("pin") JsonNullable pin,
+ @JsonProperty("amount") JsonNullable amount,
+ @JsonProperty("currency") JsonNullable currency,
+ @JsonProperty("external_identifier") JsonNullable externalIdentifier) {
+ Utils.checkNotNull(number, "number");
+ Utils.checkNotNull(pin, "pin");
+ Utils.checkNotNull(amount, "amount");
+ Utils.checkNotNull(currency, "currency");
+ Utils.checkNotNull(externalIdentifier, "externalIdentifier");
+ this.number = number;
+ this.pin = pin;
+ this.amount = amount;
+ this.currency = currency;
+ this.externalIdentifier = externalIdentifier;
+ }
+
+ public GiftCardActivationCreate(
+ String number) {
+ this(number, JsonNullable.undefined(), JsonNullable.undefined(),
+ JsonNullable.undefined(), JsonNullable.undefined());
+ }
+
+ /**
+ * The 16-19 digit number for the gift card.
+ */
+ @JsonIgnore
+ public String number() {
+ return number;
+ }
+
+ /**
+ * The PIN for this gift card.
+ */
+ @JsonIgnore
+ public JsonNullable pin() {
+ return pin;
+ }
+
+ /**
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if
+ * `currency` is provided.
+ */
+ @JsonIgnore
+ public JsonNullable amount() {
+ return amount;
+ }
+
+ /**
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
+ */
+ @JsonIgnore
+ public JsonNullable currency() {
+ return currency;
+ }
+
+ /**
+ * An optional external identifier for this activation.
+ */
+ @JsonIgnore
+ public JsonNullable externalIdentifier() {
+ return externalIdentifier;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * The 16-19 digit number for the gift card.
+ */
+ public GiftCardActivationCreate withNumber(String number) {
+ Utils.checkNotNull(number, "number");
+ this.number = number;
+ return this;
+ }
+
+ /**
+ * The PIN for this gift card.
+ */
+ public GiftCardActivationCreate withPin(String pin) {
+ Utils.checkNotNull(pin, "pin");
+ this.pin = JsonNullable.of(pin);
+ return this;
+ }
+
+ /**
+ * The PIN for this gift card.
+ */
+ public GiftCardActivationCreate withPin(JsonNullable pin) {
+ Utils.checkNotNull(pin, "pin");
+ this.pin = pin;
+ return this;
+ }
+
+ /**
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if
+ * `currency` is provided.
+ */
+ public GiftCardActivationCreate withAmount(long amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = JsonNullable.of(amount);
+ return this;
+ }
+
+ /**
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if
+ * `currency` is provided.
+ */
+ public GiftCardActivationCreate withAmount(JsonNullable amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = amount;
+ return this;
+ }
+
+ /**
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
+ */
+ public GiftCardActivationCreate withCurrency(String currency) {
+ Utils.checkNotNull(currency, "currency");
+ this.currency = JsonNullable.of(currency);
+ return this;
+ }
+
+ /**
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
+ */
+ public GiftCardActivationCreate withCurrency(JsonNullable currency) {
+ Utils.checkNotNull(currency, "currency");
+ this.currency = currency;
+ return this;
+ }
+
+ /**
+ * An optional external identifier for this activation.
+ */
+ public GiftCardActivationCreate withExternalIdentifier(String externalIdentifier) {
+ Utils.checkNotNull(externalIdentifier, "externalIdentifier");
+ this.externalIdentifier = JsonNullable.of(externalIdentifier);
+ return this;
+ }
+
+ /**
+ * An optional external identifier for this activation.
+ */
+ public GiftCardActivationCreate withExternalIdentifier(JsonNullable externalIdentifier) {
+ Utils.checkNotNull(externalIdentifier, "externalIdentifier");
+ this.externalIdentifier = externalIdentifier;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GiftCardActivationCreate other = (GiftCardActivationCreate) o;
+ return
+ Utils.enhancedDeepEquals(this.number, other.number) &&
+ Utils.enhancedDeepEquals(this.pin, other.pin) &&
+ Utils.enhancedDeepEquals(this.amount, other.amount) &&
+ Utils.enhancedDeepEquals(this.currency, other.currency) &&
+ Utils.enhancedDeepEquals(this.externalIdentifier, other.externalIdentifier);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ number, pin, amount,
+ currency, externalIdentifier);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(GiftCardActivationCreate.class,
+ "number", number,
+ "pin", pin,
+ "amount", amount,
+ "currency", currency,
+ "externalIdentifier", externalIdentifier);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private String number;
+
+ private JsonNullable pin = JsonNullable.undefined();
+
+ private JsonNullable amount = JsonNullable.undefined();
+
+ private JsonNullable currency = JsonNullable.undefined();
+
+ private JsonNullable externalIdentifier = JsonNullable.undefined();
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * The 16-19 digit number for the gift card.
+ */
+ public Builder number(String number) {
+ Utils.checkNotNull(number, "number");
+ this.number = number;
+ return this;
+ }
+
+
+ /**
+ * The PIN for this gift card.
+ */
+ public Builder pin(String pin) {
+ Utils.checkNotNull(pin, "pin");
+ this.pin = JsonNullable.of(pin);
+ return this;
+ }
+
+ /**
+ * The PIN for this gift card.
+ */
+ public Builder pin(JsonNullable pin) {
+ Utils.checkNotNull(pin, "pin");
+ this.pin = pin;
+ return this;
+ }
+
+
+ /**
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if
+ * `currency` is provided.
+ */
+ public Builder amount(long amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = JsonNullable.of(amount);
+ return this;
+ }
+
+ /**
+ * The amount to load onto the gift card, in the smallest denomination for the currency. Required if
+ * `currency` is provided.
+ */
+ public Builder amount(JsonNullable amount) {
+ Utils.checkNotNull(amount, "amount");
+ this.amount = amount;
+ return this;
+ }
+
+
+ /**
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
+ */
+ public Builder currency(String currency) {
+ Utils.checkNotNull(currency, "currency");
+ this.currency = JsonNullable.of(currency);
+ return this;
+ }
+
+ /**
+ * The ISO-4217 currency code for the `amount`. Required if `amount` is provided.
+ */
+ public Builder currency(JsonNullable currency) {
+ Utils.checkNotNull(currency, "currency");
+ this.currency = currency;
+ return this;
+ }
+
+
+ /**
+ * An optional external identifier for this activation.
+ */
+ public Builder externalIdentifier(String externalIdentifier) {
+ Utils.checkNotNull(externalIdentifier, "externalIdentifier");
+ this.externalIdentifier = JsonNullable.of(externalIdentifier);
+ return this;
+ }
+
+ /**
+ * An optional external identifier for this activation.
+ */
+ public Builder externalIdentifier(JsonNullable externalIdentifier) {
+ Utils.checkNotNull(externalIdentifier, "externalIdentifier");
+ this.externalIdentifier = externalIdentifier;
+ return this;
+ }
+
+ public GiftCardActivationCreate build() {
+
+ return new GiftCardActivationCreate(
+ number, pin, amount,
+ currency, externalIdentifier);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardRequest.java
new file mode 100644
index 00000000..345d53f8
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardRequest.java
@@ -0,0 +1,225 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gr4vy.sdk.models.components.GiftCardActivationCreate;
+import com.gr4vy.sdk.utils.SpeakeasyMetadata;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Override;
+import java.lang.String;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+
+public class ActivateGiftCardRequest {
+ /**
+ * A unique key that identifies this request. If supported by the gift card service, the value will be
+ * forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string
+ * with enough entropy to avoid collisions.
+ */
+ @SpeakeasyMetadata("header:style=simple,explode=false,name=idempotency-key")
+ private JsonNullable idempotencyKey;
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id")
+ private JsonNullable merchantAccountId;
+
+
+ @SpeakeasyMetadata("request:mediaType=application/json")
+ private GiftCardActivationCreate giftCardActivationCreate;
+
+ @JsonCreator
+ public ActivateGiftCardRequest(
+ JsonNullable idempotencyKey,
+ JsonNullable merchantAccountId,
+ GiftCardActivationCreate giftCardActivationCreate) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ Utils.checkNotNull(giftCardActivationCreate, "giftCardActivationCreate");
+ this.idempotencyKey = idempotencyKey;
+ this.merchantAccountId = merchantAccountId;
+ this.giftCardActivationCreate = giftCardActivationCreate;
+ }
+
+ public ActivateGiftCardRequest(
+ GiftCardActivationCreate giftCardActivationCreate) {
+ this(JsonNullable.undefined(), JsonNullable.undefined(), giftCardActivationCreate);
+ }
+
+ /**
+ * A unique key that identifies this request. If supported by the gift card service, the value will be
+ * forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string
+ * with enough entropy to avoid collisions.
+ */
+ @JsonIgnore
+ public JsonNullable idempotencyKey() {
+ return idempotencyKey;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ @JsonIgnore
+ public JsonNullable merchantAccountId() {
+ return merchantAccountId;
+ }
+
+ @JsonIgnore
+ public GiftCardActivationCreate giftCardActivationCreate() {
+ return giftCardActivationCreate;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * A unique key that identifies this request. If supported by the gift card service, the value will be
+ * forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string
+ * with enough entropy to avoid collisions.
+ */
+ public ActivateGiftCardRequest withIdempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ /**
+ * A unique key that identifies this request. If supported by the gift card service, the value will be
+ * forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string
+ * with enough entropy to avoid collisions.
+ */
+ public ActivateGiftCardRequest withIdempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public ActivateGiftCardRequest withMerchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public ActivateGiftCardRequest withMerchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+ public ActivateGiftCardRequest withGiftCardActivationCreate(GiftCardActivationCreate giftCardActivationCreate) {
+ Utils.checkNotNull(giftCardActivationCreate, "giftCardActivationCreate");
+ this.giftCardActivationCreate = giftCardActivationCreate;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ActivateGiftCardRequest other = (ActivateGiftCardRequest) o;
+ return
+ Utils.enhancedDeepEquals(this.idempotencyKey, other.idempotencyKey) &&
+ Utils.enhancedDeepEquals(this.merchantAccountId, other.merchantAccountId) &&
+ Utils.enhancedDeepEquals(this.giftCardActivationCreate, other.giftCardActivationCreate);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ idempotencyKey, merchantAccountId, giftCardActivationCreate);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(ActivateGiftCardRequest.class,
+ "idempotencyKey", idempotencyKey,
+ "merchantAccountId", merchantAccountId,
+ "giftCardActivationCreate", giftCardActivationCreate);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private JsonNullable idempotencyKey = JsonNullable.undefined();
+
+ private JsonNullable merchantAccountId = JsonNullable.undefined();
+
+ private GiftCardActivationCreate giftCardActivationCreate;
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * A unique key that identifies this request. If supported by the gift card service, the value will be
+ * forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string
+ * with enough entropy to avoid collisions.
+ */
+ public Builder idempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ /**
+ * A unique key that identifies this request. If supported by the gift card service, the value will be
+ * forwarded to make the activation idempotent. We recommend using V4 UUIDs, or another random string
+ * with enough entropy to avoid collisions.
+ */
+ public Builder idempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public Builder merchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ /**
+ * The ID of the merchant account to use for this request.
+ */
+ public Builder merchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+
+ public Builder giftCardActivationCreate(GiftCardActivationCreate giftCardActivationCreate) {
+ Utils.checkNotNull(giftCardActivationCreate, "giftCardActivationCreate");
+ this.giftCardActivationCreate = giftCardActivationCreate;
+ return this;
+ }
+
+ public ActivateGiftCardRequest build() {
+
+ return new ActivateGiftCardRequest(
+ idempotencyKey, merchantAccountId, giftCardActivationCreate);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardRequestBuilder.java
new file mode 100644
index 00000000..be702ce6
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardRequestBuilder.java
@@ -0,0 +1,76 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations;
+
+import static com.gr4vy.sdk.operations.Operations.RequestOperation;
+
+import com.gr4vy.sdk.SDKConfiguration;
+import com.gr4vy.sdk.models.components.GiftCardActivationCreate;
+import com.gr4vy.sdk.operations.ActivateGiftCard;
+import com.gr4vy.sdk.utils.Headers;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.String;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+public class ActivateGiftCardRequestBuilder {
+
+ private JsonNullable idempotencyKey = JsonNullable.undefined();
+ private JsonNullable merchantAccountId = JsonNullable.undefined();
+ private GiftCardActivationCreate giftCardActivationCreate;
+ private final SDKConfiguration sdkConfiguration;
+ private final Headers _headers = new Headers();
+
+ public ActivateGiftCardRequestBuilder(SDKConfiguration sdkConfiguration) {
+ this.sdkConfiguration = sdkConfiguration;
+ }
+
+ public ActivateGiftCardRequestBuilder idempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder idempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder merchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder merchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder giftCardActivationCreate(GiftCardActivationCreate giftCardActivationCreate) {
+ Utils.checkNotNull(giftCardActivationCreate, "giftCardActivationCreate");
+ this.giftCardActivationCreate = giftCardActivationCreate;
+ return this;
+ }
+
+
+ private ActivateGiftCardRequest buildRequest() {
+
+ ActivateGiftCardRequest request = new ActivateGiftCardRequest(idempotencyKey,
+ merchantAccountId,
+ giftCardActivationCreate);
+
+ return request;
+ }
+
+ public ActivateGiftCardResponse call() {
+
+ RequestOperation operation
+ = new ActivateGiftCard.Sync(sdkConfiguration, _headers);
+ ActivateGiftCardRequest request = buildRequest();
+
+ return operation.handleResponse(operation.doRequest(request));
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardResponse.java
new file mode 100644
index 00000000..1f2a8402
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/ActivateGiftCardResponse.java
@@ -0,0 +1,253 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gr4vy.sdk.models.components.GiftCard;
+import com.gr4vy.sdk.utils.Response;
+import com.gr4vy.sdk.utils.Utils;
+import java.io.InputStream;
+import java.lang.Integer;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+
+
+public class ActivateGiftCardResponse implements Response {
+ /**
+ * HTTP response content type for this operation
+ */
+ private String contentType;
+
+ /**
+ * HTTP response status code for this operation
+ */
+ private int statusCode;
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ private HttpResponse rawResponse;
+
+ /**
+ * Successful Response
+ */
+ private Optional extends GiftCard> giftCard;
+
+ @JsonCreator
+ public ActivateGiftCardResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse,
+ Optional extends GiftCard> giftCard) {
+ Utils.checkNotNull(contentType, "contentType");
+ Utils.checkNotNull(statusCode, "statusCode");
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.contentType = contentType;
+ this.statusCode = statusCode;
+ this.rawResponse = rawResponse;
+ this.giftCard = giftCard;
+ }
+
+ public ActivateGiftCardResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse) {
+ this(contentType, statusCode, rawResponse,
+ Optional.empty());
+ }
+
+ /**
+ * HTTP response content type for this operation
+ */
+ @JsonIgnore
+ public String contentType() {
+ return contentType;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ @JsonIgnore
+ public int statusCode() {
+ return statusCode;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ @JsonIgnore
+ public HttpResponse rawResponse() {
+ return rawResponse;
+ }
+
+ /**
+ * Successful Response
+ */
+ @SuppressWarnings("unchecked")
+ @JsonIgnore
+ public Optional giftCard() {
+ return (Optional) giftCard;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public ActivateGiftCardResponse withContentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public ActivateGiftCardResponse withStatusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public ActivateGiftCardResponse withRawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public ActivateGiftCardResponse withGiftCard(GiftCard giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = Optional.ofNullable(giftCard);
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public ActivateGiftCardResponse withGiftCard(Optional extends GiftCard> giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = giftCard;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ActivateGiftCardResponse other = (ActivateGiftCardResponse) o;
+ return
+ Utils.enhancedDeepEquals(this.contentType, other.contentType) &&
+ Utils.enhancedDeepEquals(this.statusCode, other.statusCode) &&
+ Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) &&
+ Utils.enhancedDeepEquals(this.giftCard, other.giftCard);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ contentType, statusCode, rawResponse,
+ giftCard);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(ActivateGiftCardResponse.class,
+ "contentType", contentType,
+ "statusCode", statusCode,
+ "rawResponse", rawResponse,
+ "giftCard", giftCard);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private String contentType;
+
+ private Integer statusCode;
+
+ private HttpResponse rawResponse;
+
+ private Optional extends GiftCard> giftCard = Optional.empty();
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public Builder contentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public Builder statusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public Builder rawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public Builder giftCard(GiftCard giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = Optional.ofNullable(giftCard);
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public Builder giftCard(Optional extends GiftCard> giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = giftCard;
+ return this;
+ }
+
+ public ActivateGiftCardResponse build() {
+
+ return new ActivateGiftCardResponse(
+ contentType, statusCode, rawResponse,
+ giftCard);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/ActivateGiftCardRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/async/ActivateGiftCardRequestBuilder.java
new file mode 100644
index 00000000..6b9e2d75
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/async/ActivateGiftCardRequestBuilder.java
@@ -0,0 +1,79 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations.async;
+
+import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation;
+
+import com.gr4vy.sdk.SDKConfiguration;
+import com.gr4vy.sdk.models.components.GiftCardActivationCreate;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardRequest;
+import com.gr4vy.sdk.operations.ActivateGiftCard;
+import com.gr4vy.sdk.utils.Headers;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.String;
+import java.util.concurrent.CompletableFuture;
+import org.openapitools.jackson.nullable.JsonNullable;
+
+public class ActivateGiftCardRequestBuilder {
+
+ private JsonNullable idempotencyKey = JsonNullable.undefined();
+ private JsonNullable merchantAccountId = JsonNullable.undefined();
+ private GiftCardActivationCreate giftCardActivationCreate;
+ private final SDKConfiguration sdkConfiguration;
+ private final Headers _headers = new Headers();
+
+ public ActivateGiftCardRequestBuilder(SDKConfiguration sdkConfiguration) {
+ this.sdkConfiguration = sdkConfiguration;
+ }
+
+ public ActivateGiftCardRequestBuilder idempotencyKey(String idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = JsonNullable.of(idempotencyKey);
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder idempotencyKey(JsonNullable idempotencyKey) {
+ Utils.checkNotNull(idempotencyKey, "idempotencyKey");
+ this.idempotencyKey = idempotencyKey;
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder merchantAccountId(String merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = JsonNullable.of(merchantAccountId);
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder merchantAccountId(JsonNullable merchantAccountId) {
+ Utils.checkNotNull(merchantAccountId, "merchantAccountId");
+ this.merchantAccountId = merchantAccountId;
+ return this;
+ }
+
+ public ActivateGiftCardRequestBuilder giftCardActivationCreate(GiftCardActivationCreate giftCardActivationCreate) {
+ Utils.checkNotNull(giftCardActivationCreate, "giftCardActivationCreate");
+ this.giftCardActivationCreate = giftCardActivationCreate;
+ return this;
+ }
+
+
+ private ActivateGiftCardRequest buildRequest() {
+
+ ActivateGiftCardRequest request = new ActivateGiftCardRequest(idempotencyKey,
+ merchantAccountId,
+ giftCardActivationCreate);
+
+ return request;
+ }
+
+ public CompletableFuture call() {
+
+ AsyncRequestOperation operation
+ = new ActivateGiftCard.Async(sdkConfiguration, _headers);
+ ActivateGiftCardRequest request = buildRequest();
+
+ return operation.doRequest(request)
+ .thenCompose(operation::handleResponse);
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/ActivateGiftCardResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/async/ActivateGiftCardResponse.java
new file mode 100644
index 00000000..34429be8
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/models/operations/async/ActivateGiftCardResponse.java
@@ -0,0 +1,253 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.models.operations.async;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.gr4vy.sdk.models.components.GiftCard;
+import com.gr4vy.sdk.utils.AsyncResponse;
+import com.gr4vy.sdk.utils.Blob;
+import com.gr4vy.sdk.utils.Utils;
+import java.lang.Integer;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+
+
+public class ActivateGiftCardResponse implements AsyncResponse {
+ /**
+ * HTTP response content type for this operation
+ */
+ private String contentType;
+
+ /**
+ * HTTP response status code for this operation
+ */
+ private int statusCode;
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ private HttpResponse rawResponse;
+
+ /**
+ * Successful Response
+ */
+ private Optional extends GiftCard> giftCard;
+
+ @JsonCreator
+ public ActivateGiftCardResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse,
+ Optional extends GiftCard> giftCard) {
+ Utils.checkNotNull(contentType, "contentType");
+ Utils.checkNotNull(statusCode, "statusCode");
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.contentType = contentType;
+ this.statusCode = statusCode;
+ this.rawResponse = rawResponse;
+ this.giftCard = giftCard;
+ }
+
+ public ActivateGiftCardResponse(
+ String contentType,
+ int statusCode,
+ HttpResponse rawResponse) {
+ this(contentType, statusCode, rawResponse,
+ Optional.empty());
+ }
+
+ /**
+ * HTTP response content type for this operation
+ */
+ @JsonIgnore
+ public String contentType() {
+ return contentType;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ @JsonIgnore
+ public int statusCode() {
+ return statusCode;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ @JsonIgnore
+ public HttpResponse rawResponse() {
+ return rawResponse;
+ }
+
+ /**
+ * Successful Response
+ */
+ @SuppressWarnings("unchecked")
+ @JsonIgnore
+ public Optional giftCard() {
+ return (Optional) giftCard;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public ActivateGiftCardResponse withContentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public ActivateGiftCardResponse withStatusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public ActivateGiftCardResponse withRawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public ActivateGiftCardResponse withGiftCard(GiftCard giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = Optional.ofNullable(giftCard);
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public ActivateGiftCardResponse withGiftCard(Optional extends GiftCard> giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = giftCard;
+ return this;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ActivateGiftCardResponse other = (ActivateGiftCardResponse) o;
+ return
+ Utils.enhancedDeepEquals(this.contentType, other.contentType) &&
+ Utils.enhancedDeepEquals(this.statusCode, other.statusCode) &&
+ Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) &&
+ Utils.enhancedDeepEquals(this.giftCard, other.giftCard);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.enhancedHash(
+ contentType, statusCode, rawResponse,
+ giftCard);
+ }
+
+ @Override
+ public String toString() {
+ return Utils.toString(ActivateGiftCardResponse.class,
+ "contentType", contentType,
+ "statusCode", statusCode,
+ "rawResponse", rawResponse,
+ "giftCard", giftCard);
+ }
+
+ @SuppressWarnings("UnusedReturnValue")
+ public final static class Builder {
+
+ private String contentType;
+
+ private Integer statusCode;
+
+ private HttpResponse rawResponse;
+
+ private Optional extends GiftCard> giftCard = Optional.empty();
+
+ private Builder() {
+ // force use of static builder() method
+ }
+
+
+ /**
+ * HTTP response content type for this operation
+ */
+ public Builder contentType(String contentType) {
+ Utils.checkNotNull(contentType, "contentType");
+ this.contentType = contentType;
+ return this;
+ }
+
+
+ /**
+ * HTTP response status code for this operation
+ */
+ public Builder statusCode(int statusCode) {
+ Utils.checkNotNull(statusCode, "statusCode");
+ this.statusCode = statusCode;
+ return this;
+ }
+
+
+ /**
+ * Raw HTTP response; suitable for custom response parsing
+ */
+ public Builder rawResponse(HttpResponse rawResponse) {
+ Utils.checkNotNull(rawResponse, "rawResponse");
+ this.rawResponse = rawResponse;
+ return this;
+ }
+
+
+ /**
+ * Successful Response
+ */
+ public Builder giftCard(GiftCard giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = Optional.ofNullable(giftCard);
+ return this;
+ }
+
+ /**
+ * Successful Response
+ */
+ public Builder giftCard(Optional extends GiftCard> giftCard) {
+ Utils.checkNotNull(giftCard, "giftCard");
+ this.giftCard = giftCard;
+ return this;
+ }
+
+ public ActivateGiftCardResponse build() {
+
+ return new ActivateGiftCardResponse(
+ contentType, statusCode, rawResponse,
+ giftCard);
+ }
+
+ }
+}
diff --git a/src/main/java/com/gr4vy/sdk/operations/ActivateGiftCard.java b/src/main/java/com/gr4vy/sdk/operations/ActivateGiftCard.java
new file mode 100644
index 00000000..9a621b2e
--- /dev/null
+++ b/src/main/java/com/gr4vy/sdk/operations/ActivateGiftCard.java
@@ -0,0 +1,458 @@
+/*
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package com.gr4vy.sdk.operations;
+
+import static com.gr4vy.sdk.operations.Operations.RequestOperation;
+import static com.gr4vy.sdk.utils.Exceptions.unchecked;
+import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.gr4vy.sdk.SDKConfiguration;
+import com.gr4vy.sdk.SecuritySource;
+import com.gr4vy.sdk.models.components.GiftCard;
+import com.gr4vy.sdk.models.errors.APIException;
+import com.gr4vy.sdk.models.errors.Error400;
+import com.gr4vy.sdk.models.errors.Error401;
+import com.gr4vy.sdk.models.errors.Error403;
+import com.gr4vy.sdk.models.errors.Error404;
+import com.gr4vy.sdk.models.errors.Error405;
+import com.gr4vy.sdk.models.errors.Error409;
+import com.gr4vy.sdk.models.errors.Error425;
+import com.gr4vy.sdk.models.errors.Error429;
+import com.gr4vy.sdk.models.errors.Error500;
+import com.gr4vy.sdk.models.errors.Error502;
+import com.gr4vy.sdk.models.errors.Error504;
+import com.gr4vy.sdk.models.errors.HTTPValidationError;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardRequest;
+import com.gr4vy.sdk.models.operations.ActivateGiftCardResponse;
+import com.gr4vy.sdk.utils.Blob;
+import com.gr4vy.sdk.utils.Globals;
+import com.gr4vy.sdk.utils.HTTPClient;
+import com.gr4vy.sdk.utils.HTTPRequest;
+import com.gr4vy.sdk.utils.Headers;
+import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl;
+import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl;
+import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl;
+import com.gr4vy.sdk.utils.SerializedBody;
+import com.gr4vy.sdk.utils.Utils.JsonShape;
+import com.gr4vy.sdk.utils.Utils;
+import java.io.InputStream;
+import java.lang.Exception;
+import java.lang.IllegalArgumentException;
+import java.lang.Object;
+import java.lang.String;
+import java.lang.Throwable;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Function;
+
+
+public class ActivateGiftCard {
+
+ static abstract class Base {
+ final SDKConfiguration sdkConfiguration;
+ final String baseUrl;
+ final SecuritySource securitySource;
+ final HTTPClient client;
+ final Headers _headers;
+ final Globals operationGlobals;
+
+ public Base(SDKConfiguration sdkConfiguration, Headers _headers) {
+ this.sdkConfiguration = sdkConfiguration;
+ this._headers =_headers;
+ this.baseUrl = Utils.templateUrl(
+ this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
+ this.securitySource = this.sdkConfiguration.securitySource();
+ this.client = this.sdkConfiguration.client();
+ this.operationGlobals = new Globals();
+ this.sdkConfiguration.globals.getParam("header", "x-gr4vy-merchant-account-id")
+ .ifPresent(param -> operationGlobals.putParam("header", "x-gr4vy-merchant-account-id", param));
+ }
+
+ Optional securitySource() {
+ return Optional.ofNullable(this.securitySource);
+ }
+
+ BeforeRequestContextImpl createBeforeRequestContext() {
+ return new BeforeRequestContextImpl(
+ this.sdkConfiguration,
+ this.baseUrl,
+ "activate_gift_card",
+ java.util.Optional.empty(),
+ securitySource());
+ }
+
+ AfterSuccessContextImpl createAfterSuccessContext() {
+ return new AfterSuccessContextImpl(
+ this.sdkConfiguration,
+ this.baseUrl,
+ "activate_gift_card",
+ java.util.Optional.empty(),
+ securitySource());
+ }
+
+ AfterErrorContextImpl createAfterErrorContext() {
+ return new AfterErrorContextImpl(
+ this.sdkConfiguration,
+ this.baseUrl,
+ "activate_gift_card",
+ java.util.Optional.empty(),
+ securitySource());
+ }
+ HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception {
+ String url = Utils.generateURL(
+ this.baseUrl,
+ "/gift-cards/activations");
+ HTTPRequest req = new HTTPRequest(url, "POST");
+ Object convertedRequest = Utils.convertToShape(
+ request,
+ JsonShape.DEFAULT,
+ typeReference);
+ SerializedBody serializedRequestBody = Utils.serializeRequestBody(
+ convertedRequest,
+ "giftCardActivationCreate",
+ "json",
+ false);
+ if (serializedRequestBody == null) {
+ throw new IllegalArgumentException("Request body is required");
+ }
+ req.setBody(Optional.ofNullable(serializedRequestBody));
+ req.addHeader("Accept", "application/json")
+ .addHeader("user-agent", SDKConfiguration.USER_AGENT);
+ _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v)));
+ req.addHeaders(Utils.getHeadersFromMetadata(request, this.operationGlobals));
+ Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity());
+
+ return req.build();
+ }
+ }
+
+ public static class Sync extends Base
+ implements RequestOperation {
+ public Sync(SDKConfiguration sdkConfiguration, Headers _headers) {
+ super(sdkConfiguration, _headers);
+ }
+
+ private HttpRequest onBuildRequest(ActivateGiftCardRequest request) throws Exception {
+ HttpRequest req = buildRequest(request, new TypeReference() {});
+ return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req);
+ }
+
+ private HttpResponse onError(HttpResponse response, Exception error) throws Exception {
+ return sdkConfiguration.hooks().afterError(
+ createAfterErrorContext(),
+ Optional.ofNullable(response),
+ Optional.ofNullable(error));
+ }
+
+ private HttpResponse onSuccess(HttpResponse response) throws Exception {
+ return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response);
+ }
+
+ @Override
+ public HttpResponse doRequest(ActivateGiftCardRequest request) {
+ HttpRequest r = unchecked(() -> onBuildRequest(request)).get();
+ HttpResponse httpRes;
+ try {
+ httpRes = client.send(r);
+ if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) {
+ httpRes = onError(httpRes, null);
+ } else {
+ httpRes = onSuccess(httpRes);
+ }
+ } catch (Exception e) {
+ httpRes = unchecked(() -> onError(null, e)).get();
+ }
+
+ return httpRes;
+ }
+
+
+ @Override
+ public ActivateGiftCardResponse handleResponse(HttpResponse response) {
+ String contentType = response
+ .headers()
+ .firstValue("Content-Type")
+ .orElse("application/octet-stream");
+ ActivateGiftCardResponse.Builder resBuilder =
+ ActivateGiftCardResponse
+ .builder()
+ .contentType(contentType)
+ .statusCode(response.statusCode())
+ .rawResponse(response);
+
+ ActivateGiftCardResponse res = resBuilder.build();
+
+ if (Utils.statusCodeMatches(response.statusCode(), "201")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return res.withGiftCard(Utils.unmarshal(response, new TypeReference() {}));
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "400")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error400.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "401")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error401.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "403")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error403.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "404")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error404.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "405")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error405.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "409")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error409.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "422")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw HTTPValidationError.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "425")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error425.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "429")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error429.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "500")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error500.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "502")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error502.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "504")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ throw Error504.from(response);
+ } else {
+ throw APIException.from("Unexpected content-type received: " + contentType, response);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "4XX")) {
+ // no content
+ throw APIException.from("API error occurred", response);
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "5XX")) {
+ // no content
+ throw APIException.from("API error occurred", response);
+ }
+ throw APIException.from("Unexpected status code received: " + response.statusCode(), response);
+ }
+ }
+ public static class Async extends Base
+ implements AsyncRequestOperation {
+
+ public Async(SDKConfiguration sdkConfiguration, Headers _headers) {
+ super(sdkConfiguration, _headers);
+ }
+
+ private CompletableFuture onBuildRequest(ActivateGiftCardRequest request) throws Exception {
+ HttpRequest req = buildRequest(request, new TypeReference() {});
+ return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req);
+ }
+
+ private CompletableFuture> onError(HttpResponse response, Throwable error) {
+ return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error);
+ }
+
+ private CompletableFuture> onSuccess(HttpResponse response) {
+ return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response);
+ }
+
+ @Override
+ public CompletableFuture> doRequest(ActivateGiftCardRequest request) {
+ return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync)
+ .handle((resp, err) -> {
+ if (err != null) {
+ return onError(null, err);
+ }
+ if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) {
+ return onError(resp, null);
+ }
+ return CompletableFuture.completedFuture(resp);
+ })
+ .thenCompose(Function.identity())
+ .thenCompose(this::onSuccess);
+ }
+
+ @Override
+ public CompletableFuture handleResponse(
+ HttpResponse response) {
+ String contentType = response
+ .headers()
+ .firstValue("Content-Type")
+ .orElse("application/octet-stream");
+ com.gr4vy.sdk.models.operations.async.ActivateGiftCardResponse.Builder resBuilder =
+ com.gr4vy.sdk.models.operations.async.ActivateGiftCardResponse
+ .builder()
+ .contentType(contentType)
+ .statusCode(response.statusCode())
+ .rawResponse(response);
+
+ com.gr4vy.sdk.models.operations.async.ActivateGiftCardResponse res = resBuilder.build();
+
+ if (Utils.statusCodeMatches(response.statusCode(), "201")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Utils.unmarshalAsync(response, new TypeReference() {})
+ .thenApply(res::withGiftCard);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "400")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error400.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "401")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error401.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "403")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error403.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "404")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error404.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "405")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error405.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "409")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error409.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "422")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return HTTPValidationError.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "425")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error425.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "429")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error429.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "500")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error500.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "502")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error502.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "504")) {
+ if (Utils.contentTypeMatches(contentType, "application/json")) {
+ return Error504.fromAsync(response)
+ .thenCompose(CompletableFuture::failedFuture);
+ } else {
+ return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType);
+ }
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "4XX")) {
+ // no content
+ return Utils.createAsyncApiError(response, "API error occurred");
+ }
+ if (Utils.statusCodeMatches(response.statusCode(), "5XX")) {
+ // no content
+ return Utils.createAsyncApiError(response, "API error occurred");
+ }
+ return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode());
+ }
+ }
+}