diff --git a/README.md b/README.md index 19ad596..8914433 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.docusign:iam-sdk:1.0.0-beta.6' +implementation 'com.docusign:iam-sdk:1.0.0-beta.7' ``` Maven: @@ -62,7 +62,7 @@ Maven: com.docusign iam-sdk - 1.0.0-beta.6 + 1.0.0-beta.7 ``` @@ -312,6 +312,11 @@ var res = sdk.auth().getUserInfo().call(); * [deleteAgreement](docs/sdks/agreements/README.md#deleteagreement) - Delete a specific agreement * [createAgreementSummary](docs/sdks/agreements/README.md#createagreementsummary) - Create an AI-generated summary of an agreement document +#### [workspaces().workspaceBrands()](docs/sdks/workspacebrands/README.md) + +* [getWorkspaceBrand](docs/sdks/workspacebrands/README.md#getworkspacebrand) - Returns details about the brand set for a workspace +* [updateWorkspaceBrand](docs/sdks/workspacebrands/README.md#updateworkspacebrand) - Updates brand for an existing workspace + #### [workspaces().workspaceDocuments()](docs/sdks/workspacedocuments/README.md) * [getWorkspaceDocuments](docs/sdks/workspacedocuments/README.md#getworkspacedocuments) - Get documents in the workspace accessible to the calling user @@ -324,6 +329,7 @@ var res = sdk.auth().getUserInfo().call(); * [getWorkspaces](docs/sdks/workspaces2/README.md#getworkspaces) - Gets workspaces available to the calling user * [createWorkspace](docs/sdks/workspaces2/README.md#createworkspace) - Creates a new workspace +* [updateWorkspace](docs/sdks/workspaces2/README.md#updateworkspace) - Updates an existing workspace * [getWorkspace](docs/sdks/workspaces2/README.md#getworkspace) - Returns details about the workspace * [getWorkspaceAssignableRoles](docs/sdks/workspaces2/README.md#getworkspaceassignableroles) - Returns the roles the caller can assign to workspace users * [createWorkspaceEnvelope](docs/sdks/workspaces2/README.md#createworkspaceenvelope) - Creates an envelope with the given documents. Returns the ID of the created envelope @@ -461,15 +467,19 @@ public class Application { Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. -By default, an API error will throw a `models/errors/APIException` exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `getTokenFromConfidentialAuthCode` method throws the following exceptions: -| Error Type | Status Code | Content Type | -| -------------------------------- | ----------- | ---------------- | -| models/errors/OAuthErrorResponse | 400 | application/json | -| models/errors/APIException | 4XX, 5XX | \*/\* | +[`IamClientError`](./src/main/java/models/errors/IamClientError.java) is the base class for all HTTP error responses. It has the following properties: -### Example +| Method | Type | Description | +| ---------------- | --------------------------- | ------------------------------------------------------------------------ | +| `message()` | `String` | Error message | +| `code()` | `int` | HTTP response status code eg `404` | +| `headers` | `Map>` | HTTP response headers | +| `body()` | `byte[]` | HTTP body as a byte array. Can be empty array if no body is returned. | +| `bodyAsString()` | `String` | HTTP body as a UTF-8 string. Can be empty string if no body is returned. | +| `rawResponse()` | `HttpResponse` | Raw HTTP response (body already read and not available for re-read) | +### Example ```java package hello.world; @@ -505,6 +515,29 @@ public class Application { } } ``` + +### Error Classes +**Primary error:** +* [`IamClientError`](./src/main/java/models/errors/IamClientError.java): The base class for HTTP error responses. + +
Less common errors (9) + +
+ +**Network errors:** +* `java.io.IOException` (always wrapped by `java.io.UncheckedIOException`). Commonly encountered subclasses of +`IOException` include `java.net.ConnectException`, `java.net.SocketTimeoutException`, `EOFException` (there are +many more subclasses in the JDK platform). + +**Inherit from [`IamClientError`](./src/main/java/models/errors/IamClientError.java)**: +* [`com.docusign.iam.sdk.models.errors.ErrorDetails`](./src/main/java/models/errors/com.docusign.iam.sdk.models.errors.ErrorDetails.java): The error response object for the Workspaces API. Applicable to 26 of 44 methods.* +* [`com.docusign.iam.sdk.models.errors.Error`](./src/main/java/models/errors/com.docusign.iam.sdk.models.errors.Error.java): Bad Request - The request could not be understood or was missing required parameters. Applicable to 11 of 44 methods.* +* [`com.docusign.iam.sdk.models.errors.OAuthErrorResponse`](./src/main/java/models/errors/com.docusign.iam.sdk.models.errors.OAuthErrorResponse.java): Status code `400`. Applicable to 5 of 44 methods.* + + +
+ +\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable. diff --git a/RELEASES.md b/RELEASES.md index 3e89e05..fba3f5e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -67,4 +67,14 @@ Based on: ### Generated - [java v1.0.0-beta.6] . ### Releases -- [Maven Central v1.0.0-beta.6] https://central.sonatype.com/artifact/com.docusign/iam-sdk/1.0.0-beta.6 - . \ No newline at end of file +- [Maven Central v1.0.0-beta.6] https://central.sonatype.com/artifact/com.docusign/iam-sdk/1.0.0-beta.6 - . + +## 2025-10-17 12:40:18 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.637.0 (2.727.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v1.0.0-beta.7] . +### Releases +- [Maven Central v1.0.0-beta.7] https://central.sonatype.com/artifact/com.docusign/iam-sdk/1.0.0-beta.7 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 90408d3..b25b82c 100644 --- a/build.gradle +++ b/build.gradle @@ -81,6 +81,7 @@ dependencies { implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2' api('org.openapitools:jackson-databind-nullable:0.2.6') {exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'} implementation 'commons-io:commons-io:2.18.0' + implementation 'jakarta.annotation:jakarta.annotation-api:3.0.0' } ext { diff --git a/docs/models/components/BrandColor.md b/docs/models/components/BrandColor.md new file mode 100644 index 0000000..a1de48b --- /dev/null +++ b/docs/models/components/BrandColor.md @@ -0,0 +1,9 @@ +# BrandColor + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `name` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `value` | *JsonNullable\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/BrandLogos.md b/docs/models/components/BrandLogos.md new file mode 100644 index 0000000..279dab0 --- /dev/null +++ b/docs/models/components/BrandLogos.md @@ -0,0 +1,10 @@ +# BrandLogos + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `primary` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `secondary` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `email` | *JsonNullable\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/GetWorkspaceBrandResponse.md b/docs/models/components/GetWorkspaceBrandResponse.md new file mode 100644 index 0000000..4abdc93 --- /dev/null +++ b/docs/models/components/GetWorkspaceBrandResponse.md @@ -0,0 +1,21 @@ +# GetWorkspaceBrandResponse + +The details of a single workspace brand + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `brandId` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `brandName` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `brandCompany` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `colors` | List\<[BrandColor](../../models/components/BrandColor.md)> | :heavy_check_mark: | N/A | +| `logos` | [Optional\](../../models/components/BrandLogos.md) | :heavy_minus_sign: | N/A | +| `brandLanguages` | List\<*String*> | :heavy_check_mark: | N/A | +| `defaultBrandLanguage` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `isSendingDefault` | *Optional\* | :heavy_minus_sign: | N/A | +| `isSigningDefault` | *Optional\* | :heavy_minus_sign: | N/A | +| `primaryLogoId` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `secondaryLogoId` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `emailLogoId` | *JsonNullable\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/UpdateWorkspaceBody.md b/docs/models/components/UpdateWorkspaceBody.md new file mode 100644 index 0000000..936b00e --- /dev/null +++ b/docs/models/components/UpdateWorkspaceBody.md @@ -0,0 +1,8 @@ +# UpdateWorkspaceBody + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `name` | *Optional\* | :heavy_check_mark: | The updated name of the workspace | \ No newline at end of file diff --git a/docs/models/components/UpdateWorkspaceBrandBody.md b/docs/models/components/UpdateWorkspaceBrandBody.md new file mode 100644 index 0000000..cae4fd0 --- /dev/null +++ b/docs/models/components/UpdateWorkspaceBrandBody.md @@ -0,0 +1,8 @@ +# UpdateWorkspaceBrandBody + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `brandId` | *JsonNullable\* | :heavy_minus_sign: | A GUID value that identifies a brand. For more information, see Branding | \ No newline at end of file diff --git a/docs/models/components/UpdateWorkspaceBrandResponse.md b/docs/models/components/UpdateWorkspaceBrandResponse.md new file mode 100644 index 0000000..1248dfd --- /dev/null +++ b/docs/models/components/UpdateWorkspaceBrandResponse.md @@ -0,0 +1,21 @@ +# UpdateWorkspaceBrandResponse + +The brand details set for a workspace + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `brandId` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `brandName` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `brandCompany` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `colors` | List\<[BrandColor](../../models/components/BrandColor.md)> | :heavy_check_mark: | N/A | +| `logos` | [Optional\](../../models/components/BrandLogos.md) | :heavy_minus_sign: | N/A | +| `brandLanguages` | List\<*String*> | :heavy_check_mark: | N/A | +| `defaultBrandLanguage` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `isSendingDefault` | *Optional\* | :heavy_minus_sign: | N/A | +| `isSigningDefault` | *Optional\* | :heavy_minus_sign: | N/A | +| `primaryLogoId` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `secondaryLogoId` | *JsonNullable\* | :heavy_minus_sign: | N/A | +| `emailLogoId` | *JsonNullable\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/UpdateWorkspaceResponse.md b/docs/models/components/UpdateWorkspaceResponse.md new file mode 100644 index 0000000..c6ba55a --- /dev/null +++ b/docs/models/components/UpdateWorkspaceResponse.md @@ -0,0 +1,14 @@ +# UpdateWorkspaceResponse + +The details of a single workspace + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | +| `name` | *JsonNullable\* | :heavy_minus_sign: | The name of the workspace | +| `createdDate` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | The date the workspace was created | +| `createdByUserId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the user who created the workspace | +| `workspaceOwnerIds` | List\<*String*> | :heavy_minus_sign: | The list of user IDs of the workspace owners | \ No newline at end of file diff --git a/docs/models/components/UpdateWorkspaceUploadRequestBody.md b/docs/models/components/UpdateWorkspaceUploadRequestBody.md index 9c215d8..ab2917a 100644 --- a/docs/models/components/UpdateWorkspaceUploadRequestBody.md +++ b/docs/models/components/UpdateWorkspaceUploadRequestBody.md @@ -17,7 +17,7 @@ Upload request details for update operations | `assignments` | List\<[WorkspaceUploadRequestAssignment](../../models/components/WorkspaceUploadRequestAssignment.md)> | :heavy_minus_sign: | List of user assignments for the upload request | | `createdDate` | *JsonNullable\* | :heavy_minus_sign: | The date the upload request was created | | `updatedDate` | *JsonNullable\* | :heavy_minus_sign: | The date the upload request was last updated | -| `dueDate` | *Optional\* | :heavy_check_mark: | The due date for the upload request (editable) | +| `dueDate` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The due date for the upload request (editable) | | `sentDate` | *JsonNullable\* | :heavy_minus_sign: | The date the upload request was sent | | `completedDate` | *JsonNullable\* | :heavy_minus_sign: | The date the upload request was completed | | `canView` | *JsonNullable\* | :heavy_minus_sign: | Whether the current user can view the upload request | diff --git a/docs/models/operations/GetWorkspaceBrandRequest.md b/docs/models/operations/GetWorkspaceBrandRequest.md new file mode 100644 index 0000000..6252a3d --- /dev/null +++ b/docs/models/operations/GetWorkspaceBrandRequest.md @@ -0,0 +1,9 @@ +# GetWorkspaceBrandRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `accountId` | *String* | :heavy_check_mark: | The ID of the account | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | \ No newline at end of file diff --git a/docs/models/operations/GetWorkspaceBrandResponse.md b/docs/models/operations/GetWorkspaceBrandResponse.md new file mode 100644 index 0000000..1a62459 --- /dev/null +++ b/docs/models/operations/GetWorkspaceBrandResponse.md @@ -0,0 +1,11 @@ +# GetWorkspaceBrandResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `getWorkspaceBrandResponse` | [Optional\](../../models/components/GetWorkspaceBrandResponse.md) | :heavy_minus_sign: | Workspace successfully retrieved | \ No newline at end of file diff --git a/docs/models/operations/UpdateWorkspaceBrandRequest.md b/docs/models/operations/UpdateWorkspaceBrandRequest.md new file mode 100644 index 0000000..399303a --- /dev/null +++ b/docs/models/operations/UpdateWorkspaceBrandRequest.md @@ -0,0 +1,10 @@ +# UpdateWorkspaceBrandRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `accountId` | *String* | :heavy_check_mark: | The ID of the account | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | +| `updateWorkspaceBrandBody` | [UpdateWorkspaceBrandBody](../../models/components/UpdateWorkspaceBrandBody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/UpdateWorkspaceBrandResponse.md b/docs/models/operations/UpdateWorkspaceBrandResponse.md new file mode 100644 index 0000000..29a07a0 --- /dev/null +++ b/docs/models/operations/UpdateWorkspaceBrandResponse.md @@ -0,0 +1,11 @@ +# UpdateWorkspaceBrandResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `updateWorkspaceBrandResponse` | [Optional\](../../models/components/UpdateWorkspaceBrandResponse.md) | :heavy_minus_sign: | Workspace brand successfully updated | \ No newline at end of file diff --git a/docs/models/operations/UpdateWorkspaceRequest.md b/docs/models/operations/UpdateWorkspaceRequest.md new file mode 100644 index 0000000..4e0e576 --- /dev/null +++ b/docs/models/operations/UpdateWorkspaceRequest.md @@ -0,0 +1,10 @@ +# UpdateWorkspaceRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `accountId` | *String* | :heavy_check_mark: | The ID of the account | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | +| `updateWorkspaceBody` | [UpdateWorkspaceBody](../../models/components/UpdateWorkspaceBody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/UpdateWorkspaceResponse.md b/docs/models/operations/UpdateWorkspaceResponse.md new file mode 100644 index 0000000..7e51c1a --- /dev/null +++ b/docs/models/operations/UpdateWorkspaceResponse.md @@ -0,0 +1,11 @@ +# UpdateWorkspaceResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `updateWorkspaceResponse` | [Optional\](../../models/components/UpdateWorkspaceResponse.md) | :heavy_minus_sign: | Workspace successfully updated | \ No newline at end of file diff --git a/docs/sdks/workspacebrands/README.md b/docs/sdks/workspacebrands/README.md new file mode 100644 index 0000000..fc5408f --- /dev/null +++ b/docs/sdks/workspacebrands/README.md @@ -0,0 +1,121 @@ +# WorkspaceBrands +(*workspaces().workspaceBrands()*) + +## Overview + +### Available Operations + +* [getWorkspaceBrand](#getworkspacebrand) - Returns details about the brand set for a workspace +* [updateWorkspaceBrand](#updateworkspacebrand) - Updates brand for an existing workspace + +## getWorkspaceBrand + +This operation retrieves details about a specific workspace. It returns the brand details such as its unique identifier (ID), name, and metadata such as brand colors and logos. + +### Example Usage + + +```java +package hello.world; + +import com.docusign.iam.sdk.IamClient; +import com.docusign.iam.sdk.models.errors.ErrorDetails; +import com.docusign.iam.sdk.models.operations.GetWorkspaceBrandResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws ErrorDetails, ErrorDetails, Exception { + + IamClient sdk = IamClient.builder() + .accessToken(System.getenv().getOrDefault("ACCESS_TOKEN", "")) + .build(); + + GetWorkspaceBrandResponse res = sdk.workspaces().workspaceBrands().getWorkspaceBrand() + .accountId("0bfcafb4-f092-4bc8-8ef8-948bc7bf03c3") + .workspaceId("a0cddd57-5c88-4a44-afcc-5b6de2154b65") + .call(); + + if (res.getWorkspaceBrandResponse().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `accountId` | *String* | :heavy_check_mark: | The ID of the account | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | + +### Response + +**[GetWorkspaceBrandResponse](../../models/operations/GetWorkspaceBrandResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/ErrorDetails | 400, 401 | application/json | +| models/errors/ErrorDetails | 500 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## updateWorkspaceBrand + +This operation updates brand for a specific workspace. It returns the brand details such as its unique identifier (ID), name, and metadata such as brand colors and logos. + +### Example Usage + + +```java +package hello.world; + +import com.docusign.iam.sdk.IamClient; +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBrandBody; +import com.docusign.iam.sdk.models.errors.ErrorDetails; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceBrandResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws ErrorDetails, ErrorDetails, Exception { + + IamClient sdk = IamClient.builder() + .accessToken(System.getenv().getOrDefault("ACCESS_TOKEN", "")) + .build(); + + UpdateWorkspaceBrandResponse res = sdk.workspaces().workspaceBrands().updateWorkspaceBrand() + .accountId("1b06d538-9938-4fc1-ac20-f9284b7b9a0a") + .workspaceId("e99e34d2-4d67-46bb-89e6-29aec34fda9e") + .updateWorkspaceBrandBody(UpdateWorkspaceBrandBody.builder() + .build()) + .call(); + + if (res.updateWorkspaceBrandResponse().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `accountId` | *String* | :heavy_check_mark: | The ID of the account | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | +| `updateWorkspaceBrandBody` | [UpdateWorkspaceBrandBody](../../models/components/UpdateWorkspaceBrandBody.md) | :heavy_check_mark: | N/A | + +### Response + +**[UpdateWorkspaceBrandResponse](../../models/operations/UpdateWorkspaceBrandResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/ErrorDetails | 400, 401 | application/json | +| models/errors/ErrorDetails | 500 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/workspaces2/README.md b/docs/sdks/workspaces2/README.md index d28634a..011f42b 100644 --- a/docs/sdks/workspaces2/README.md +++ b/docs/sdks/workspaces2/README.md @@ -7,6 +7,7 @@ * [getWorkspaces](#getworkspaces) - Gets workspaces available to the calling user * [createWorkspace](#createworkspace) - Creates a new workspace +* [updateWorkspace](#updateworkspace) - Updates an existing workspace * [getWorkspace](#getworkspace) - Returns details about the workspace * [getWorkspaceAssignableRoles](#getworkspaceassignableroles) - Returns the roles the caller can assign to workspace users * [createWorkspaceEnvelope](#createworkspaceenvelope) - Creates an envelope with the given documents. Returns the ID of the created envelope @@ -127,6 +128,65 @@ public class Application { | models/errors/ErrorDetails | 500 | application/json | | models/errors/APIException | 4XX, 5XX | \*/\* | +## updateWorkspace + +This operation updates details about a specific workspace. It returns the workspace's unique identifier (ID), name, and metadata such as when it was created and by whom. + +### Example Usage + + +```java +package hello.world; + +import com.docusign.iam.sdk.IamClient; +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBody; +import com.docusign.iam.sdk.models.errors.ErrorDetails; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws ErrorDetails, ErrorDetails, Exception { + + IamClient sdk = IamClient.builder() + .accessToken(System.getenv().getOrDefault("ACCESS_TOKEN", "")) + .build(); + + UpdateWorkspaceResponse res = sdk.workspaces().workspaces().updateWorkspace() + .accountId("a03ca946-93ee-47cf-8cbe-a53c7e3284bf") + .workspaceId("c41ace15-4a79-4fe4-84bb-81adc9c7df98") + .updateWorkspaceBody(UpdateWorkspaceBody.builder() + .name("") + .build()) + .call(); + + if (res.updateWorkspaceResponse().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `accountId` | *String* | :heavy_check_mark: | The ID of the account | +| `workspaceId` | *String* | :heavy_check_mark: | The ID of the workspace | +| `updateWorkspaceBody` | [UpdateWorkspaceBody](../../models/components/UpdateWorkspaceBody.md) | :heavy_check_mark: | N/A | + +### Response + +**[UpdateWorkspaceResponse](../../models/operations/UpdateWorkspaceResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/ErrorDetails | 400, 401 | application/json | +| models/errors/ErrorDetails | 500 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + ## getWorkspace This operation retrieves details about a specific workspace. It returns the workspace's unique identifier (ID), name, and metadata such as when it was created and by whom. diff --git a/docs/sdks/workspaceuploadrequest/README.md b/docs/sdks/workspaceuploadrequest/README.md index a06cc08..a4e9a3b 100644 --- a/docs/sdks/workspaceuploadrequest/README.md +++ b/docs/sdks/workspaceuploadrequest/README.md @@ -207,6 +207,7 @@ import com.docusign.iam.sdk.models.components.WorkspaceUploadRequestStatus; import com.docusign.iam.sdk.models.errors.ErrorDetails; import com.docusign.iam.sdk.models.operations.UpdateWorkspaceUploadRequestResponse; import java.lang.Exception; +import java.time.OffsetDateTime; public class Application { @@ -224,7 +225,7 @@ public class Application { .name("") .description("at providence phew furthermore save digitize than how circa never") .status(WorkspaceUploadRequestStatus.OVERDUE) - .dueDate("") + .dueDate(OffsetDateTime.parse("")) .build()) .call(); diff --git a/gradle.properties b/gradle.properties index bf947f5..a577a25 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ groupId=com.docusign artifactId=iam-sdk -version=1.0.0-beta.6 +version=1.0.0-beta.7 org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g diff --git a/src/main/java/com/docusign/iam/sdk/Agreements.java b/src/main/java/com/docusign/iam/sdk/Agreements.java index 8ffa33c..3387d10 100644 --- a/src/main/java/com/docusign/iam/sdk/Agreements.java +++ b/src/main/java/com/docusign/iam/sdk/Agreements.java @@ -23,7 +23,6 @@ import com.docusign.iam.sdk.operations.GetAgreementsList; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -128,9 +127,9 @@ public GetAgreementsListRequestBuilder getAgreementsList() { * * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetAgreementsListResponse getAgreementsList(GetAgreementsListRequest request) throws Exception { + public GetAgreementsListResponse getAgreementsList(GetAgreementsListRequest request) { return getAgreementsList(request, Optional.empty()); } @@ -179,9 +178,9 @@ public GetAgreementsListResponse getAgreementsList(GetAgreementsListRequest requ * @param request The request object containing all the parameters for the API call. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetAgreementsListResponse getAgreementsList(GetAgreementsListRequest request, Optional options) throws Exception { + public GetAgreementsListResponse getAgreementsList(GetAgreementsListRequest request, Optional options) { RequestOperation operation = new GetAgreementsList.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); @@ -294,9 +293,9 @@ public GetAgreementRequestBuilder getAgreement() { * @param accountId * @param agreementId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetAgreementResponse getAgreement(String accountId, String agreementId) throws Exception { + public GetAgreementResponse getAgreement(String accountId, String agreementId) { return getAgreement(accountId, agreementId, Optional.empty()); } @@ -353,11 +352,11 @@ public GetAgreementResponse getAgreement(String accountId, String agreementId) t * @param agreementId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetAgreementResponse getAgreement( String accountId, String agreementId, - Optional options) throws Exception { + Optional options) { GetAgreementRequest request = GetAgreementRequest .builder() @@ -390,9 +389,9 @@ public DeleteAgreementRequestBuilder deleteAgreement() { * @param accountId * @param agreementId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public DeleteAgreementResponse deleteAgreement(String accountId, String agreementId) throws Exception { + public DeleteAgreementResponse deleteAgreement(String accountId, String agreementId) { return deleteAgreement(accountId, agreementId, Optional.empty()); } @@ -406,11 +405,11 @@ public DeleteAgreementResponse deleteAgreement(String accountId, String agreemen * @param agreementId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public DeleteAgreementResponse deleteAgreement( String accountId, String agreementId, - Optional options) throws Exception { + Optional options) { DeleteAgreementRequest request = DeleteAgreementRequest .builder() @@ -455,9 +454,9 @@ public CreateAgreementSummaryRequestBuilder createAgreementSummary() { * @param accountId * @param agreementId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateAgreementSummaryResponse createAgreementSummary(String accountId, String agreementId) throws Exception { + public CreateAgreementSummaryResponse createAgreementSummary(String accountId, String agreementId) { return createAgreementSummary(accountId, agreementId, Optional.empty()); } @@ -477,11 +476,11 @@ public CreateAgreementSummaryResponse createAgreementSummary(String accountId, S * @param agreementId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CreateAgreementSummaryResponse createAgreementSummary( String accountId, String agreementId, - Optional options) throws Exception { + Optional options) { CreateAgreementSummaryRequest request = CreateAgreementSummaryRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/Auth.java b/src/main/java/com/docusign/iam/sdk/Auth.java index 59e0c37..081664c 100644 --- a/src/main/java/com/docusign/iam/sdk/Auth.java +++ b/src/main/java/com/docusign/iam/sdk/Auth.java @@ -29,7 +29,6 @@ import com.docusign.iam.sdk.operations.GetUserInfo; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -67,9 +66,9 @@ public GetTokenFromConfidentialAuthCodeRequestBuilder getTokenFromConfidentialAu * @param request The request object containing all the parameters for the API call. * @param security The security details to use for authentication. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetTokenFromConfidentialAuthCodeResponse getTokenFromConfidentialAuthCode(ConfidentialAuthCodeGrantRequestBody request, GetTokenFromConfidentialAuthCodeSecurity security) throws Exception { + public GetTokenFromConfidentialAuthCodeResponse getTokenFromConfidentialAuthCode(ConfidentialAuthCodeGrantRequestBody request, GetTokenFromConfidentialAuthCodeSecurity security) { return getTokenFromConfidentialAuthCode(request, security, Optional.empty(), Optional.empty()); } @@ -87,11 +86,11 @@ public GetTokenFromConfidentialAuthCodeResponse getTokenFromConfidentialAuthCode * @param serverURL Overrides the server URL. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetTokenFromConfidentialAuthCodeResponse getTokenFromConfidentialAuthCode( ConfidentialAuthCodeGrantRequestBody request, GetTokenFromConfidentialAuthCodeSecurity security, - Optional serverURL, Optional options) throws Exception { + Optional serverURL, Optional options) { RequestOperation operation = new GetTokenFromConfidentialAuthCode.Sync( sdkConfiguration, security, serverURL, @@ -123,9 +122,9 @@ public GetTokenFromPublicAuthCodeRequestBuilder getTokenFromPublicAuthCode() { * * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetTokenFromPublicAuthCodeResponse getTokenFromPublicAuthCode(PublicAuthCodeGrantRequestBody request) throws Exception { + public GetTokenFromPublicAuthCodeResponse getTokenFromPublicAuthCode(PublicAuthCodeGrantRequestBody request) { return getTokenFromPublicAuthCode(request, Optional.empty(), Optional.empty()); } @@ -141,11 +140,11 @@ public GetTokenFromPublicAuthCodeResponse getTokenFromPublicAuthCode(PublicAuthC * @param serverURL Overrides the server URL. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetTokenFromPublicAuthCodeResponse getTokenFromPublicAuthCode( PublicAuthCodeGrantRequestBody request, Optional serverURL, - Optional options) throws Exception { + Optional options) { RequestOperation operation = new GetTokenFromPublicAuthCode.Sync( sdkConfiguration, serverURL, options, @@ -183,9 +182,9 @@ public GetTokenFromJWTGrantRequestBuilder getTokenFromJwtGrant() { * * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetTokenFromJWTGrantResponse getTokenFromJwtGrant(JWTGrant request) throws Exception { + public GetTokenFromJWTGrantResponse getTokenFromJwtGrant(JWTGrant request) { return getTokenFromJwtGrant(request, Optional.empty(), Optional.empty()); } @@ -204,11 +203,11 @@ public GetTokenFromJWTGrantResponse getTokenFromJwtGrant(JWTGrant request) throw * @param serverURL Overrides the server URL. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetTokenFromJWTGrantResponse getTokenFromJwtGrant( JWTGrant request, Optional serverURL, - Optional options) throws Exception { + Optional options) { RequestOperation operation = new GetTokenFromJWTGrant.Sync( sdkConfiguration, serverURL, options, @@ -243,9 +242,9 @@ public GetTokenFromRefreshTokenRequestBuilder getTokenFromRefreshToken() { * @param request The request object containing all the parameters for the API call. * @param security The security details to use for authentication. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetTokenFromRefreshTokenResponse getTokenFromRefreshToken(AuthorizationCodeGrant request, GetTokenFromRefreshTokenSecurity security) throws Exception { + public GetTokenFromRefreshTokenResponse getTokenFromRefreshToken(AuthorizationCodeGrant request, GetTokenFromRefreshTokenSecurity security) { return getTokenFromRefreshToken(request, security, Optional.empty(), Optional.empty()); } @@ -264,11 +263,11 @@ public GetTokenFromRefreshTokenResponse getTokenFromRefreshToken(AuthorizationCo * @param serverURL Overrides the server URL. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetTokenFromRefreshTokenResponse getTokenFromRefreshToken( AuthorizationCodeGrant request, GetTokenFromRefreshTokenSecurity security, - Optional serverURL, Optional options) throws Exception { + Optional serverURL, Optional options) { RequestOperation operation = new GetTokenFromRefreshToken.Sync( sdkConfiguration, security, serverURL, @@ -297,9 +296,9 @@ public GetUserInfoRequestBuilder getUserInfo() { * For the production environment, the URI is https://account.docusign.com/oauth/userinfo * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetUserInfoResponse getUserInfoDirect() throws Exception { + public GetUserInfoResponse getUserInfoDirect() { return getUserInfo(Optional.empty(), Optional.empty()); } @@ -313,9 +312,9 @@ public GetUserInfoResponse getUserInfoDirect() throws Exception { * @param serverURL Overrides the server URL. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetUserInfoResponse getUserInfo(Optional serverURL, Optional options) throws Exception { + public GetUserInfoResponse getUserInfo(Optional serverURL, Optional options) { RequestlessOperation operation = new GetUserInfo.Sync( sdkConfiguration, serverURL, options, diff --git a/src/main/java/com/docusign/iam/sdk/SDKConfiguration.java b/src/main/java/com/docusign/iam/sdk/SDKConfiguration.java index a0a647c..101ae66 100644 --- a/src/main/java/com/docusign/iam/sdk/SDKConfiguration.java +++ b/src/main/java/com/docusign/iam/sdk/SDKConfiguration.java @@ -16,8 +16,8 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "v1"; - public static final String SDK_VERSION = "1.0.0-beta.6"; - public static final String GEN_VERSION = "2.723.8"; + public static final String SDK_VERSION = "1.0.0-beta.7"; + public static final String GEN_VERSION = "2.727.4"; private static final String BASE_PACKAGE = "com.docusign.iam.sdk"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", diff --git a/src/main/java/com/docusign/iam/sdk/TabInfo.java b/src/main/java/com/docusign/iam/sdk/TabInfo.java index 6e160f6..3d834c2 100644 --- a/src/main/java/com/docusign/iam/sdk/TabInfo.java +++ b/src/main/java/com/docusign/iam/sdk/TabInfo.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.operations.ConnectedFieldsApiGetTabGroups; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -50,9 +49,9 @@ public ConnectedFieldsApiGetTabGroupsRequestBuilder getConnectedFieldsTabGroups( * * @param accountId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public ConnectedFieldsApiGetTabGroupsResponse getConnectedFieldsTabGroups(String accountId) throws Exception { + public ConnectedFieldsApiGetTabGroupsResponse getConnectedFieldsTabGroups(String accountId) { return getConnectedFieldsTabGroups(accountId, Optional.empty(), Optional.empty()); } @@ -69,11 +68,11 @@ public ConnectedFieldsApiGetTabGroupsResponse getConnectedFieldsTabGroups(String * @param appId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public ConnectedFieldsApiGetTabGroupsResponse getConnectedFieldsTabGroups( String accountId, Optional appId, - Optional options) throws Exception { + Optional options) { ConnectedFieldsApiGetTabGroupsRequest request = ConnectedFieldsApiGetTabGroupsRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/WorkflowInstanceManagement.java b/src/main/java/com/docusign/iam/sdk/WorkflowInstanceManagement.java index 3986235..9445d49 100644 --- a/src/main/java/com/docusign/iam/sdk/WorkflowInstanceManagement.java +++ b/src/main/java/com/docusign/iam/sdk/WorkflowInstanceManagement.java @@ -19,7 +19,6 @@ import com.docusign.iam.sdk.operations.GetWorkflowInstancesList; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -99,9 +98,9 @@ public GetWorkflowInstancesListRequestBuilder getWorkflowInstancesList() { * @param accountId The unique identifier of the account. * @param workflowId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkflowInstancesListResponse getWorkflowInstancesList(String accountId, String workflowId) throws Exception { + public GetWorkflowInstancesListResponse getWorkflowInstancesList(String accountId, String workflowId) { return getWorkflowInstancesList(accountId, workflowId, Optional.empty()); } @@ -138,11 +137,11 @@ public GetWorkflowInstancesListResponse getWorkflowInstancesList(String accountI * @param workflowId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkflowInstancesListResponse getWorkflowInstancesList( String accountId, String workflowId, - Optional options) throws Exception { + Optional options) { GetWorkflowInstancesListRequest request = GetWorkflowInstancesListRequest .builder() @@ -214,11 +213,11 @@ public GetWorkflowInstanceRequestBuilder getWorkflowInstance() { * @param workflowId * @param instanceId Unique identifier for the workflow instance * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkflowInstanceResponse getWorkflowInstance( String accountId, String workflowId, - String instanceId) throws Exception { + String instanceId) { return getWorkflowInstance(accountId, workflowId, instanceId, Optional.empty()); } @@ -253,11 +252,11 @@ public GetWorkflowInstanceResponse getWorkflowInstance( * @param instanceId Unique identifier for the workflow instance * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkflowInstanceResponse getWorkflowInstance( String accountId, String workflowId, - String instanceId, Optional options) throws Exception { + String instanceId, Optional options) { GetWorkflowInstanceRequest request = GetWorkflowInstanceRequest .builder() @@ -310,11 +309,11 @@ public CancelWorkflowInstanceRequestBuilder cancelWorkflowInstance() { * @param workflowId * @param instanceId Unique identifier for the workflow instance * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CancelWorkflowInstanceResponse cancelWorkflowInstance( String accountId, String workflowId, - String instanceId) throws Exception { + String instanceId) { return cancelWorkflowInstance(accountId, workflowId, instanceId, Optional.empty()); } @@ -339,11 +338,11 @@ public CancelWorkflowInstanceResponse cancelWorkflowInstance( * @param instanceId Unique identifier for the workflow instance * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CancelWorkflowInstanceResponse cancelWorkflowInstance( String accountId, String workflowId, - String instanceId, Optional options) throws Exception { + String instanceId, Optional options) { CancelWorkflowInstanceRequest request = CancelWorkflowInstanceRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/Workflows.java b/src/main/java/com/docusign/iam/sdk/Workflows.java index 5ff22f3..9e44f3c 100644 --- a/src/main/java/com/docusign/iam/sdk/Workflows.java +++ b/src/main/java/com/docusign/iam/sdk/Workflows.java @@ -28,7 +28,6 @@ import com.docusign.iam.sdk.operations.ResumePausedWorkflow; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -117,9 +116,9 @@ public GetWorkflowsListRequestBuilder getWorkflowsList() { * * @param accountId The unique identifier of the account. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkflowsListResponse getWorkflowsList(String accountId) throws Exception { + public GetWorkflowsListResponse getWorkflowsList(String accountId) { return getWorkflowsList(accountId, Optional.empty(), Optional.empty()); } @@ -168,11 +167,11 @@ public GetWorkflowsListResponse getWorkflowsList(String accountId) throws Except * * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkflowsListResponse getWorkflowsList( String accountId, Optional status, - Optional options) throws Exception { + Optional options) { GetWorkflowsListRequest request = GetWorkflowsListRequest .builder() @@ -251,9 +250,9 @@ public GetWorkflowTriggerRequirementsRequestBuilder getWorkflowTriggerRequiremen * @param accountId The unique identifier of the account. * @param workflowId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkflowTriggerRequirementsResponse getWorkflowTriggerRequirements(String accountId, String workflowId) throws Exception { + public GetWorkflowTriggerRequirementsResponse getWorkflowTriggerRequirements(String accountId, String workflowId) { return getWorkflowTriggerRequirements(accountId, workflowId, Optional.empty()); } @@ -290,11 +289,11 @@ public GetWorkflowTriggerRequirementsResponse getWorkflowTriggerRequirements(Str * @param workflowId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkflowTriggerRequirementsResponse getWorkflowTriggerRequirements( String accountId, String workflowId, - Optional options) throws Exception { + Optional options) { GetWorkflowTriggerRequirementsRequest request = GetWorkflowTriggerRequirementsRequest .builder() @@ -396,11 +395,11 @@ public TriggerWorkflowRequestBuilder triggerWorkflow() { * - `trigger_inputs` contains the key-value pairs corresponding to the inputs required by the workflow, as described in the `trigger_input_schema` from the workflow definition. * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public TriggerWorkflowResponse triggerWorkflow( String accountId, String workflowId, - TriggerWorkflow triggerWorkflow) throws Exception { + TriggerWorkflow triggerWorkflow) { return triggerWorkflow(accountId, workflowId, triggerWorkflow, Optional.empty()); } @@ -453,11 +452,11 @@ public TriggerWorkflowResponse triggerWorkflow( * * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public TriggerWorkflowResponse triggerWorkflow( String accountId, String workflowId, - TriggerWorkflow triggerWorkflow, Optional options) throws Exception { + TriggerWorkflow triggerWorkflow, Optional options) { TriggerWorkflowRequest request = TriggerWorkflowRequest .builder() @@ -491,9 +490,9 @@ public PauseNewWorkflowInstancesRequestBuilder pauseNewWorkflowInstances() { * @param accountId The unique identifier of the account. * @param workflowId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public PauseNewWorkflowInstancesResponse pauseNewWorkflowInstances(String accountId, String workflowId) throws Exception { + public PauseNewWorkflowInstancesResponse pauseNewWorkflowInstances(String accountId, String workflowId) { return pauseNewWorkflowInstances(accountId, workflowId, Optional.empty()); } @@ -507,11 +506,11 @@ public PauseNewWorkflowInstancesResponse pauseNewWorkflowInstances(String accoun * @param workflowId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public PauseNewWorkflowInstancesResponse pauseNewWorkflowInstances( String accountId, String workflowId, - Optional options) throws Exception { + Optional options) { PauseNewWorkflowInstancesRequest request = PauseNewWorkflowInstancesRequest .builder() @@ -542,9 +541,9 @@ public ResumePausedWorkflowRequestBuilder resumePausedWorkflow() { * @param accountId The unique identifier of the account. * @param workflowId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public ResumePausedWorkflowResponse resumePausedWorkflow(String accountId, String workflowId) throws Exception { + public ResumePausedWorkflowResponse resumePausedWorkflow(String accountId, String workflowId) { return resumePausedWorkflow(accountId, workflowId, Optional.empty()); } @@ -557,11 +556,11 @@ public ResumePausedWorkflowResponse resumePausedWorkflow(String accountId, Strin * @param workflowId * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public ResumePausedWorkflowResponse resumePausedWorkflow( String accountId, String workflowId, - Optional options) throws Exception { + Optional options) { ResumePausedWorkflowRequest request = ResumePausedWorkflowRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/WorkspaceBrands.java b/src/main/java/com/docusign/iam/sdk/WorkspaceBrands.java new file mode 100644 index 0000000..c916946 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/WorkspaceBrands.java @@ -0,0 +1,143 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; + +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBrandBody; +import com.docusign.iam.sdk.models.operations.GetWorkspaceBrandRequest; +import com.docusign.iam.sdk.models.operations.GetWorkspaceBrandRequestBuilder; +import com.docusign.iam.sdk.models.operations.GetWorkspaceBrandResponse; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceBrandRequest; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceBrandRequestBuilder; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceBrandResponse; +import com.docusign.iam.sdk.operations.GetWorkspaceBrand; +import com.docusign.iam.sdk.operations.UpdateWorkspaceBrand; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Options; +import java.lang.String; +import java.util.Optional; + + +public class WorkspaceBrands { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + + WorkspaceBrands(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + /** + * Returns details about the brand set for a workspace + * + *

This operation retrieves details about a specific workspace. It returns the brand details such as + * its unique identifier (ID), name, and metadata such as brand colors and logos. + * + * @return The call builder + */ + public GetWorkspaceBrandRequestBuilder getWorkspaceBrand() { + return new GetWorkspaceBrandRequestBuilder(sdkConfiguration); + } + + /** + * Returns details about the brand set for a workspace + * + *

This operation retrieves details about a specific workspace. It returns the brand details such as + * its unique identifier (ID), name, and metadata such as brand colors and logos. + * + * @param accountId The ID of the account + * @param workspaceId The ID of the workspace + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public GetWorkspaceBrandResponse getWorkspaceBrand(String accountId, String workspaceId) { + return getWorkspaceBrand(accountId, workspaceId, Optional.empty()); + } + + /** + * Returns details about the brand set for a workspace + * + *

This operation retrieves details about a specific workspace. It returns the brand details such as + * its unique identifier (ID), name, and metadata such as brand colors and logos. + * + * @param accountId The ID of the account + * @param workspaceId The ID of the workspace + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public GetWorkspaceBrandResponse getWorkspaceBrand( + String accountId, String workspaceId, + Optional options) { + GetWorkspaceBrandRequest request = + GetWorkspaceBrandRequest + .builder() + .accountId(accountId) + .workspaceId(workspaceId) + .build(); + RequestOperation operation + = new GetWorkspaceBrand.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + + /** + * Updates brand for an existing workspace + * + *

This operation updates brand for a specific workspace. It returns the brand details such as its + * unique identifier (ID), name, and metadata such as brand colors and logos. + * + * @return The call builder + */ + public UpdateWorkspaceBrandRequestBuilder updateWorkspaceBrand() { + return new UpdateWorkspaceBrandRequestBuilder(sdkConfiguration); + } + + /** + * Updates brand for an existing workspace + * + *

This operation updates brand for a specific workspace. It returns the brand details such as its + * unique identifier (ID), name, and metadata such as brand colors and logos. + * + * @param accountId The ID of the account + * @param workspaceId The ID of the workspace + * @param updateWorkspaceBrandBody + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public UpdateWorkspaceBrandResponse updateWorkspaceBrand( + String accountId, String workspaceId, + UpdateWorkspaceBrandBody updateWorkspaceBrandBody) { + return updateWorkspaceBrand(accountId, workspaceId, updateWorkspaceBrandBody, + Optional.empty()); + } + + /** + * Updates brand for an existing workspace + * + *

This operation updates brand for a specific workspace. It returns the brand details such as its + * unique identifier (ID), name, and metadata such as brand colors and logos. + * + * @param accountId The ID of the account + * @param workspaceId The ID of the workspace + * @param updateWorkspaceBrandBody + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public UpdateWorkspaceBrandResponse updateWorkspaceBrand( + String accountId, String workspaceId, + UpdateWorkspaceBrandBody updateWorkspaceBrandBody, Optional options) { + UpdateWorkspaceBrandRequest request = + UpdateWorkspaceBrandRequest + .builder() + .accountId(accountId) + .workspaceId(workspaceId) + .updateWorkspaceBrandBody(updateWorkspaceBrandBody) + .build(); + RequestOperation operation + = new UpdateWorkspaceBrand.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + +} diff --git a/src/main/java/com/docusign/iam/sdk/WorkspaceDocuments.java b/src/main/java/com/docusign/iam/sdk/WorkspaceDocuments.java index 593a2b5..6a3d337 100644 --- a/src/main/java/com/docusign/iam/sdk/WorkspaceDocuments.java +++ b/src/main/java/com/docusign/iam/sdk/WorkspaceDocuments.java @@ -27,7 +27,6 @@ import com.docusign.iam.sdk.operations.GetWorkspaceDocuments; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -70,9 +69,9 @@ public GetWorkspaceDocumentsRequestBuilder getWorkspaceDocuments() { * * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceDocumentsResponse getWorkspaceDocuments(GetWorkspaceDocumentsRequest request) throws Exception { + public GetWorkspaceDocumentsResponse getWorkspaceDocuments(GetWorkspaceDocumentsRequest request) { return getWorkspaceDocuments(request, Optional.empty()); } @@ -90,9 +89,9 @@ public GetWorkspaceDocumentsResponse getWorkspaceDocuments(GetWorkspaceDocuments * @param request The request object containing all the parameters for the API call. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceDocumentsResponse getWorkspaceDocuments(GetWorkspaceDocumentsRequest request, Optional options) throws Exception { + public GetWorkspaceDocumentsResponse getWorkspaceDocuments(GetWorkspaceDocumentsRequest request, Optional options) { RequestOperation operation = new GetWorkspaceDocuments.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); @@ -123,9 +122,9 @@ public AddWorkspaceDocumentRequestBuilder addWorkspaceDocument() { * @param accountId The ID of the account * @param workspaceId The ID of the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public AddWorkspaceDocumentResponse addWorkspaceDocument(String accountId, String workspaceId) throws Exception { + public AddWorkspaceDocumentResponse addWorkspaceDocument(String accountId, String workspaceId) { return addWorkspaceDocument(accountId, workspaceId, Optional.empty(), Optional.empty()); } @@ -143,11 +142,11 @@ public AddWorkspaceDocumentResponse addWorkspaceDocument(String accountId, Strin * @param addWorkspaceDocumentRequest * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public AddWorkspaceDocumentResponse addWorkspaceDocument( String accountId, String workspaceId, - Optional addWorkspaceDocumentRequest, Optional options) throws Exception { + Optional addWorkspaceDocumentRequest, Optional options) { com.docusign.iam.sdk.models.operations.AddWorkspaceDocumentRequest request = com.docusign.iam.sdk.models.operations.AddWorkspaceDocumentRequest .builder() @@ -182,11 +181,11 @@ public GetWorkspaceDocumentRequestBuilder getWorkspaceDocument() { * @param workspaceId The ID of the workspace * @param documentId The ID of the document * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceDocumentResponse getWorkspaceDocument( String accountId, String workspaceId, - String documentId) throws Exception { + String documentId) { return getWorkspaceDocument(accountId, workspaceId, documentId, Optional.empty()); } @@ -202,11 +201,11 @@ public GetWorkspaceDocumentResponse getWorkspaceDocument( * @param documentId The ID of the document * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceDocumentResponse getWorkspaceDocument( String accountId, String workspaceId, - String documentId, Optional options) throws Exception { + String documentId, Optional options) { GetWorkspaceDocumentRequest request = GetWorkspaceDocumentRequest .builder() @@ -239,11 +238,11 @@ public DeleteWorkspaceDocumentRequestBuilder deleteWorkspaceDocument() { * @param workspaceId The ID of the workspace * @param documentId The ID of the document * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public DeleteWorkspaceDocumentResponse deleteWorkspaceDocument( String accountId, String workspaceId, - String documentId) throws Exception { + String documentId) { return deleteWorkspaceDocument(accountId, workspaceId, documentId, Optional.empty()); } @@ -258,11 +257,11 @@ public DeleteWorkspaceDocumentResponse deleteWorkspaceDocument( * @param documentId The ID of the document * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public DeleteWorkspaceDocumentResponse deleteWorkspaceDocument( String accountId, String workspaceId, - String documentId, Optional options) throws Exception { + String documentId, Optional options) { DeleteWorkspaceDocumentRequest request = DeleteWorkspaceDocumentRequest .builder() @@ -297,11 +296,11 @@ public GetWorkspaceDocumentContentsRequestBuilder getWorkspaceDocumentContents() * @param workspaceId The ID of the workspace * @param documentId The ID of the document * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceDocumentContentsResponse getWorkspaceDocumentContents( String accountId, String workspaceId, - String documentId) throws Exception { + String documentId) { return getWorkspaceDocumentContents(accountId, workspaceId, documentId, Optional.empty()); } @@ -317,11 +316,11 @@ public GetWorkspaceDocumentContentsResponse getWorkspaceDocumentContents( * @param documentId The ID of the document * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceDocumentContentsResponse getWorkspaceDocumentContents( String accountId, String workspaceId, - String documentId, Optional options) throws Exception { + String documentId, Optional options) { GetWorkspaceDocumentContentsRequest request = GetWorkspaceDocumentContentsRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/WorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/WorkspaceUploadRequest.java index abd6cc3..bcd96de 100644 --- a/src/main/java/com/docusign/iam/sdk/WorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/WorkspaceUploadRequest.java @@ -37,7 +37,6 @@ import com.docusign.iam.sdk.operations.UpdateWorkspaceUploadRequest; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -74,11 +73,11 @@ public CreateWorkspaceUploadRequestRequestBuilder createWorkspaceUploadRequest() * @param workspaceId The ID of the workspace * @param createWorkspaceUploadRequestBody * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CreateWorkspaceUploadRequestResponse createWorkspaceUploadRequest( String accountId, String workspaceId, - CreateWorkspaceUploadRequestBody createWorkspaceUploadRequestBody) throws Exception { + CreateWorkspaceUploadRequestBody createWorkspaceUploadRequestBody) { return createWorkspaceUploadRequest(accountId, workspaceId, createWorkspaceUploadRequestBody, Optional.empty()); } @@ -95,11 +94,11 @@ public CreateWorkspaceUploadRequestResponse createWorkspaceUploadRequest( * @param createWorkspaceUploadRequestBody * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CreateWorkspaceUploadRequestResponse createWorkspaceUploadRequest( String accountId, String workspaceId, - CreateWorkspaceUploadRequestBody createWorkspaceUploadRequestBody, Optional options) throws Exception { + CreateWorkspaceUploadRequestBody createWorkspaceUploadRequestBody, Optional options) { CreateWorkspaceUploadRequestRequest request = CreateWorkspaceUploadRequestRequest .builder() @@ -135,9 +134,9 @@ public GetWorkspaceUploadRequestsRequestBuilder getWorkspaceUploadRequests() { * @param accountId The ID of the account * @param workspaceId The ID of the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceUploadRequestsResponse getWorkspaceUploadRequests(String accountId, String workspaceId) throws Exception { + public GetWorkspaceUploadRequestsResponse getWorkspaceUploadRequests(String accountId, String workspaceId) { return getWorkspaceUploadRequests(accountId, workspaceId, Optional.empty()); } @@ -152,11 +151,11 @@ public GetWorkspaceUploadRequestsResponse getWorkspaceUploadRequests(String acco * @param workspaceId The ID of the workspace * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceUploadRequestsResponse getWorkspaceUploadRequests( String accountId, String workspaceId, - Optional options) throws Exception { + Optional options) { GetWorkspaceUploadRequestsRequest request = GetWorkspaceUploadRequestsRequest .builder() @@ -192,11 +191,11 @@ public GetWorkspaceUploadRequestRequestBuilder getWorkspaceUploadRequest() { * @param workspaceId The ID of the workspace * @param uploadRequestId The ID of the upload request * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceUploadRequestResponse getWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId) throws Exception { + String uploadRequestId) { return getWorkspaceUploadRequest(accountId, workspaceId, uploadRequestId, Optional.empty()); } @@ -213,11 +212,11 @@ public GetWorkspaceUploadRequestResponse getWorkspaceUploadRequest( * @param uploadRequestId The ID of the upload request * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceUploadRequestResponse getWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId, Optional options) throws Exception { + String uploadRequestId, Optional options) { GetWorkspaceUploadRequestRequest request = GetWorkspaceUploadRequestRequest .builder() @@ -261,11 +260,11 @@ public UpdateWorkspaceUploadRequestRequestBuilder updateWorkspaceUploadRequest() * @param uploadRequestId The ID of the upload request to update * @param updateWorkspaceUploadRequestBody Upload request details for update operations * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public UpdateWorkspaceUploadRequestResponse updateWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId, UpdateWorkspaceUploadRequestBody updateWorkspaceUploadRequestBody) throws Exception { + String uploadRequestId, UpdateWorkspaceUploadRequestBody updateWorkspaceUploadRequestBody) { return updateWorkspaceUploadRequest(accountId, workspaceId, uploadRequestId, updateWorkspaceUploadRequestBody, Optional.empty()); } @@ -286,12 +285,12 @@ public UpdateWorkspaceUploadRequestResponse updateWorkspaceUploadRequest( * @param updateWorkspaceUploadRequestBody Upload request details for update operations * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public UpdateWorkspaceUploadRequestResponse updateWorkspaceUploadRequest( String accountId, String workspaceId, String uploadRequestId, UpdateWorkspaceUploadRequestBody updateWorkspaceUploadRequestBody, - Optional options) throws Exception { + Optional options) { UpdateWorkspaceUploadRequestRequest request = UpdateWorkspaceUploadRequestRequest .builder() @@ -327,11 +326,11 @@ public DeleteWorkspaceUploadRequestRequestBuilder deleteWorkspaceUploadRequest() * @param workspaceId The ID of the workspace * @param uploadRequestId The ID of the upload request to delete * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public DeleteWorkspaceUploadRequestResponse deleteWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId) throws Exception { + String uploadRequestId) { return deleteWorkspaceUploadRequest(accountId, workspaceId, uploadRequestId, Optional.empty()); } @@ -347,11 +346,11 @@ public DeleteWorkspaceUploadRequestResponse deleteWorkspaceUploadRequest( * @param uploadRequestId The ID of the upload request to delete * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public DeleteWorkspaceUploadRequestResponse deleteWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId, Optional options) throws Exception { + String uploadRequestId, Optional options) { DeleteWorkspaceUploadRequestRequest request = DeleteWorkspaceUploadRequestRequest .builder() @@ -388,11 +387,11 @@ public AddWorkspaceUploadRequestDocumentRequestBuilder addWorkspaceUploadRequest * @param workspaceId The ID of the workspace * @param uploadRequestId The ID of the upload request * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public AddWorkspaceUploadRequestDocumentResponse addWorkspaceUploadRequestDocument( String accountId, String workspaceId, - String uploadRequestId) throws Exception { + String uploadRequestId) { return addWorkspaceUploadRequestDocument(accountId, workspaceId, uploadRequestId, Optional.empty(), Optional.empty()); } @@ -410,12 +409,12 @@ public AddWorkspaceUploadRequestDocumentResponse addWorkspaceUploadRequestDocume * @param addWorkspaceUploadRequestDocumentRequest * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public AddWorkspaceUploadRequestDocumentResponse addWorkspaceUploadRequestDocument( String accountId, String workspaceId, String uploadRequestId, Optional addWorkspaceUploadRequestDocumentRequest, - Optional options) throws Exception { + Optional options) { com.docusign.iam.sdk.models.operations.AddWorkspaceUploadRequestDocumentRequest request = com.docusign.iam.sdk.models.operations.AddWorkspaceUploadRequestDocumentRequest .builder() @@ -453,11 +452,11 @@ public CompleteWorkspaceUploadRequestRequestBuilder completeWorkspaceUploadReque * @param workspaceId The ID of the workspace * @param uploadRequestId The ID of the upload request to complete * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CompleteWorkspaceUploadRequestResponse completeWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId) throws Exception { + String uploadRequestId) { return completeWorkspaceUploadRequest(accountId, workspaceId, uploadRequestId, Optional.empty()); } @@ -474,11 +473,11 @@ public CompleteWorkspaceUploadRequestResponse completeWorkspaceUploadRequest( * @param uploadRequestId The ID of the upload request to complete * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CompleteWorkspaceUploadRequestResponse completeWorkspaceUploadRequest( String accountId, String workspaceId, - String uploadRequestId, Optional options) throws Exception { + String uploadRequestId, Optional options) { CompleteWorkspaceUploadRequestRequest request = CompleteWorkspaceUploadRequestRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/WorkspaceUsers.java b/src/main/java/com/docusign/iam/sdk/WorkspaceUsers.java index 0a7294d..efdf0ae 100644 --- a/src/main/java/com/docusign/iam/sdk/WorkspaceUsers.java +++ b/src/main/java/com/docusign/iam/sdk/WorkspaceUsers.java @@ -30,7 +30,6 @@ import com.docusign.iam.sdk.operations.UpdateWorkspaceUser; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -71,9 +70,9 @@ public GetWorkspaceUsersRequestBuilder getWorkspaceUsers() { * * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceUsersResponse getWorkspaceUsers(GetWorkspaceUsersRequest request) throws Exception { + public GetWorkspaceUsersResponse getWorkspaceUsers(GetWorkspaceUsersRequest request) { return getWorkspaceUsers(request, Optional.empty()); } @@ -90,9 +89,9 @@ public GetWorkspaceUsersResponse getWorkspaceUsers(GetWorkspaceUsersRequest requ * @param request The request object containing all the parameters for the API call. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceUsersResponse getWorkspaceUsers(GetWorkspaceUsersRequest request, Optional options) throws Exception { + public GetWorkspaceUsersResponse getWorkspaceUsers(GetWorkspaceUsersRequest request, Optional options) { RequestOperation operation = new GetWorkspaceUsers.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); @@ -133,9 +132,9 @@ public AddWorkspaceUserRequestBuilder addWorkspaceUser() { * @param accountId The ID of the account * @param workspaceId The ID of the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public AddWorkspaceUserResponse addWorkspaceUser(String accountId, String workspaceId) throws Exception { + public AddWorkspaceUserResponse addWorkspaceUser(String accountId, String workspaceId) { return addWorkspaceUser(accountId, workspaceId, Optional.empty(), Optional.empty()); } @@ -158,11 +157,11 @@ public AddWorkspaceUserResponse addWorkspaceUser(String accountId, String worksp * @param workspaceUserForCreate * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public AddWorkspaceUserResponse addWorkspaceUser( String accountId, String workspaceId, - Optional workspaceUserForCreate, Optional options) throws Exception { + Optional workspaceUserForCreate, Optional options) { AddWorkspaceUserRequest request = AddWorkspaceUserRequest .builder() @@ -199,11 +198,11 @@ public UpdateWorkspaceUserRequestBuilder updateWorkspaceUser() { * @param workspaceId The ID of the workspace * @param userId The ID of the user to update * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public UpdateWorkspaceUserResponse updateWorkspaceUser( String accountId, String workspaceId, - String userId) throws Exception { + String userId) { return updateWorkspaceUser(accountId, workspaceId, userId, Optional.empty(), Optional.empty()); } @@ -221,12 +220,12 @@ public UpdateWorkspaceUserResponse updateWorkspaceUser( * @param workspaceUserForUpdate * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public UpdateWorkspaceUserResponse updateWorkspaceUser( String accountId, String workspaceId, String userId, Optional workspaceUserForUpdate, - Optional options) throws Exception { + Optional options) { UpdateWorkspaceUserRequest request = UpdateWorkspaceUserRequest .builder() @@ -262,11 +261,11 @@ public RevokeWorkspaceUserAccessRequestBuilder revokeWorkspaceUserAccess() { * @param workspaceId The ID of the workspace to revoke access from * @param userId The ID of the user to be revoked from the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public RevokeWorkspaceUserAccessResponse revokeWorkspaceUserAccess( String accountId, String workspaceId, - String userId) throws Exception { + String userId) { return revokeWorkspaceUserAccess(accountId, workspaceId, userId, Optional.empty(), Optional.empty()); } @@ -283,12 +282,12 @@ public RevokeWorkspaceUserAccessResponse revokeWorkspaceUserAccess( * @param revokeWorkspaceUserDetails * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public RevokeWorkspaceUserAccessResponse revokeWorkspaceUserAccess( String accountId, String workspaceId, String userId, Optional revokeWorkspaceUserDetails, - Optional options) throws Exception { + Optional options) { RevokeWorkspaceUserAccessRequest request = RevokeWorkspaceUserAccessRequest .builder() @@ -324,11 +323,11 @@ public RestoreWorkspaceUserAccessRequestBuilder restoreWorkspaceUserAccess() { * @param workspaceId The ID of the workspace to restore access * @param userId The ID of the user to be restored to the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public RestoreWorkspaceUserAccessResponse restoreWorkspaceUserAccess( String accountId, String workspaceId, - String userId) throws Exception { + String userId) { return restoreWorkspaceUserAccess(accountId, workspaceId, userId, Optional.empty()); } @@ -344,11 +343,11 @@ public RestoreWorkspaceUserAccessResponse restoreWorkspaceUserAccess( * @param userId The ID of the user to be restored to the workspace * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public RestoreWorkspaceUserAccessResponse restoreWorkspaceUserAccess( String accountId, String workspaceId, - String userId, Optional options) throws Exception { + String userId, Optional options) { RestoreWorkspaceUserAccessRequest request = RestoreWorkspaceUserAccessRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/Workspaces1.java b/src/main/java/com/docusign/iam/sdk/Workspaces1.java index 616b6de..1e1fa82 100644 --- a/src/main/java/com/docusign/iam/sdk/Workspaces1.java +++ b/src/main/java/com/docusign/iam/sdk/Workspaces1.java @@ -9,6 +9,7 @@ public class Workspaces1 { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final WorkspaceBrands workspaceBrands; private final WorkspaceDocuments workspaceDocuments; private final WorkspaceUploadRequest workspaceUploadRequest; private final WorkspaceUsers workspaceUsers; @@ -16,12 +17,17 @@ public class Workspaces1 { Workspaces1(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.workspaceBrands = new WorkspaceBrands(this.sdkConfiguration); this.workspaceDocuments = new WorkspaceDocuments(this.sdkConfiguration); this.workspaceUploadRequest = new WorkspaceUploadRequest(this.sdkConfiguration); this.workspaceUsers = new WorkspaceUsers(this.sdkConfiguration); this.workspaces = new Workspaces2(this.sdkConfiguration); } + public final WorkspaceBrands workspaceBrands() { + return workspaceBrands; + } + public final WorkspaceDocuments workspaceDocuments() { return workspaceDocuments; } diff --git a/src/main/java/com/docusign/iam/sdk/Workspaces2.java b/src/main/java/com/docusign/iam/sdk/Workspaces2.java index 41df3de..e483fbf 100644 --- a/src/main/java/com/docusign/iam/sdk/Workspaces2.java +++ b/src/main/java/com/docusign/iam/sdk/Workspaces2.java @@ -6,6 +6,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import com.docusign.iam.sdk.models.components.CreateWorkspaceBody; +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBody; import com.docusign.iam.sdk.models.components.WorkspaceEnvelopeForCreate; import com.docusign.iam.sdk.models.operations.CreateWorkspaceEnvelopeRequest; import com.docusign.iam.sdk.models.operations.CreateWorkspaceEnvelopeRequestBuilder; @@ -25,15 +26,18 @@ import com.docusign.iam.sdk.models.operations.GetWorkspacesRequest; import com.docusign.iam.sdk.models.operations.GetWorkspacesRequestBuilder; import com.docusign.iam.sdk.models.operations.GetWorkspacesResponse; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceRequest; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceRequestBuilder; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceResponse; import com.docusign.iam.sdk.operations.CreateWorkspace; import com.docusign.iam.sdk.operations.CreateWorkspaceEnvelope; import com.docusign.iam.sdk.operations.GetWorkspace; import com.docusign.iam.sdk.operations.GetWorkspaceAssignableRoles; import com.docusign.iam.sdk.operations.GetWorkspaceEnvelopes; import com.docusign.iam.sdk.operations.GetWorkspaces; +import com.docusign.iam.sdk.operations.UpdateWorkspace; import com.docusign.iam.sdk.utils.Headers; import com.docusign.iam.sdk.utils.Options; -import java.lang.Exception; import java.lang.Integer; import java.lang.String; import java.util.Optional; @@ -77,9 +81,9 @@ public GetWorkspacesRequestBuilder getWorkspaces() { * * @param accountId The ID of the account * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspacesResponse getWorkspaces(String accountId) throws Exception { + public GetWorkspacesResponse getWorkspaces(String accountId) { return getWorkspaces(accountId, Optional.empty(), Optional.empty(), Optional.empty()); } @@ -100,11 +104,11 @@ public GetWorkspacesResponse getWorkspaces(String accountId) throws Exception { * @param startPosition Position of the first item in the total results. Defaults to 0 * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspacesResponse getWorkspaces( String accountId, Optional count, - Optional startPosition, Optional options) throws Exception { + Optional startPosition, Optional options) { GetWorkspacesRequest request = GetWorkspacesRequest .builder() @@ -144,9 +148,9 @@ public CreateWorkspaceRequestBuilder createWorkspace() { * @param accountId The ID of the account * @param createWorkspaceBody * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateWorkspaceResponse createWorkspace(String accountId, CreateWorkspaceBody createWorkspaceBody) throws Exception { + public CreateWorkspaceResponse createWorkspace(String accountId, CreateWorkspaceBody createWorkspaceBody) { return createWorkspace(accountId, createWorkspaceBody, Optional.empty()); } @@ -163,11 +167,11 @@ public CreateWorkspaceResponse createWorkspace(String accountId, CreateWorkspace * @param createWorkspaceBody * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CreateWorkspaceResponse createWorkspace( String accountId, CreateWorkspaceBody createWorkspaceBody, - Optional options) throws Exception { + Optional options) { CreateWorkspaceRequest request = CreateWorkspaceRequest .builder() @@ -179,6 +183,65 @@ public CreateWorkspaceResponse createWorkspace( return operation.handleResponse(operation.doRequest(request)); } + /** + * Updates an existing workspace + * + *

This operation updates details about a specific workspace. It returns the workspace's unique + * identifier (ID), name, and metadata such as when it was created and by whom. + * + * @return The call builder + */ + public UpdateWorkspaceRequestBuilder updateWorkspace() { + return new UpdateWorkspaceRequestBuilder(sdkConfiguration); + } + + /** + * Updates an existing workspace + * + *

This operation updates details about a specific workspace. It returns the workspace's unique + * identifier (ID), name, and metadata such as when it was created and by whom. + * + * @param accountId The ID of the account + * @param workspaceId The ID of the workspace + * @param updateWorkspaceBody + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public UpdateWorkspaceResponse updateWorkspace( + String accountId, String workspaceId, + UpdateWorkspaceBody updateWorkspaceBody) { + return updateWorkspace(accountId, workspaceId, updateWorkspaceBody, + Optional.empty()); + } + + /** + * Updates an existing workspace + * + *

This operation updates details about a specific workspace. It returns the workspace's unique + * identifier (ID), name, and metadata such as when it was created and by whom. + * + * @param accountId The ID of the account + * @param workspaceId The ID of the workspace + * @param updateWorkspaceBody + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public UpdateWorkspaceResponse updateWorkspace( + String accountId, String workspaceId, + UpdateWorkspaceBody updateWorkspaceBody, Optional options) { + UpdateWorkspaceRequest request = + UpdateWorkspaceRequest + .builder() + .accountId(accountId) + .workspaceId(workspaceId) + .updateWorkspaceBody(updateWorkspaceBody) + .build(); + RequestOperation operation + = new UpdateWorkspace.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + /** * Returns details about the workspace * @@ -200,9 +263,9 @@ public GetWorkspaceRequestBuilder getWorkspace() { * @param accountId The ID of the account * @param workspaceId The ID of the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceResponse getWorkspace(String accountId, String workspaceId) throws Exception { + public GetWorkspaceResponse getWorkspace(String accountId, String workspaceId) { return getWorkspace(accountId, workspaceId, Optional.empty()); } @@ -216,11 +279,11 @@ public GetWorkspaceResponse getWorkspace(String accountId, String workspaceId) t * @param workspaceId The ID of the workspace * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceResponse getWorkspace( String accountId, String workspaceId, - Optional options) throws Exception { + Optional options) { GetWorkspaceRequest request = GetWorkspaceRequest .builder() @@ -268,9 +331,9 @@ public GetWorkspaceAssignableRolesRequestBuilder getWorkspaceAssignableRoles() { * * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceAssignableRolesResponse getWorkspaceAssignableRoles(GetWorkspaceAssignableRolesRequest request) throws Exception { + public GetWorkspaceAssignableRolesResponse getWorkspaceAssignableRoles(GetWorkspaceAssignableRolesRequest request) { return getWorkspaceAssignableRoles(request, Optional.empty()); } @@ -291,9 +354,9 @@ public GetWorkspaceAssignableRolesResponse getWorkspaceAssignableRoles(GetWorksp * @param request The request object containing all the parameters for the API call. * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceAssignableRolesResponse getWorkspaceAssignableRoles(GetWorkspaceAssignableRolesRequest request, Optional options) throws Exception { + public GetWorkspaceAssignableRolesResponse getWorkspaceAssignableRoles(GetWorkspaceAssignableRolesRequest request, Optional options) { RequestOperation operation = new GetWorkspaceAssignableRoles.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); @@ -349,11 +412,11 @@ public CreateWorkspaceEnvelopeRequestBuilder createWorkspaceEnvelope() { * @param workspaceId The ID of the workspace * @param workspaceEnvelopeForCreate * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CreateWorkspaceEnvelopeResponse createWorkspaceEnvelope( String accountId, String workspaceId, - WorkspaceEnvelopeForCreate workspaceEnvelopeForCreate) throws Exception { + WorkspaceEnvelopeForCreate workspaceEnvelopeForCreate) { return createWorkspaceEnvelope(accountId, workspaceId, workspaceEnvelopeForCreate, Optional.empty()); } @@ -383,11 +446,11 @@ public CreateWorkspaceEnvelopeResponse createWorkspaceEnvelope( * @param workspaceEnvelopeForCreate * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public CreateWorkspaceEnvelopeResponse createWorkspaceEnvelope( String accountId, String workspaceId, - WorkspaceEnvelopeForCreate workspaceEnvelopeForCreate, Optional options) throws Exception { + WorkspaceEnvelopeForCreate workspaceEnvelopeForCreate, Optional options) { CreateWorkspaceEnvelopeRequest request = CreateWorkspaceEnvelopeRequest .builder() @@ -433,9 +496,9 @@ public GetWorkspaceEnvelopesRequestBuilder getWorkspaceEnvelopes() { * @param accountId The ID of the account * @param workspaceId The ID of the workspace * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWorkspaceEnvelopesResponse getWorkspaceEnvelopes(String accountId, String workspaceId) throws Exception { + public GetWorkspaceEnvelopesResponse getWorkspaceEnvelopes(String accountId, String workspaceId) { return getWorkspaceEnvelopes(accountId, workspaceId, Optional.empty()); } @@ -455,11 +518,11 @@ public GetWorkspaceEnvelopesResponse getWorkspaceEnvelopes(String accountId, Str * @param workspaceId The ID of the workspace * @param options additional options * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetWorkspaceEnvelopesResponse getWorkspaceEnvelopes( String accountId, String workspaceId, - Optional options) throws Exception { + Optional options) { GetWorkspaceEnvelopesRequest request = GetWorkspaceEnvelopesRequest .builder() diff --git a/src/main/java/com/docusign/iam/sdk/models/components/BrandColor.java b/src/main/java/com/docusign/iam/sdk/models/components/BrandColor.java new file mode 100644 index 0000000..4ddde59 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/BrandColor.java @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Override; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class BrandColor { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private JsonNullable name; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("value") + private JsonNullable value; + + @JsonCreator + public BrandColor( + @JsonProperty("name") JsonNullable name, + @JsonProperty("value") JsonNullable value) { + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(value, "value"); + this.name = name; + this.value = value; + } + + public BrandColor() { + this(JsonNullable.undefined(), JsonNullable.undefined()); + } + + @JsonIgnore + public JsonNullable name() { + return name; + } + + @JsonIgnore + public JsonNullable value() { + return value; + } + + public static Builder builder() { + return new Builder(); + } + + + public BrandColor withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + public BrandColor withName(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + public BrandColor withValue(String value) { + Utils.checkNotNull(value, "value"); + this.value = JsonNullable.of(value); + return this; + } + + public BrandColor withValue(JsonNullable value) { + Utils.checkNotNull(value, "value"); + this.value = value; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrandColor other = (BrandColor) o; + return + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.value, other.value); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + name, value); + } + + @Override + public String toString() { + return Utils.toString(BrandColor.class, + "name", name, + "value", value); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable name = JsonNullable.undefined(); + + private JsonNullable value = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + public Builder name(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + + public Builder value(String value) { + Utils.checkNotNull(value, "value"); + this.value = JsonNullable.of(value); + return this; + } + + public Builder value(JsonNullable value) { + Utils.checkNotNull(value, "value"); + this.value = value; + return this; + } + + public BrandColor build() { + + return new BrandColor( + name, value); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/BrandLogos.java b/src/main/java/com/docusign/iam/sdk/models/components/BrandLogos.java new file mode 100644 index 0000000..73dac3b --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/BrandLogos.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Override; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class BrandLogos { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("primary") + private JsonNullable primary; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("secondary") + private JsonNullable secondary; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("email") + private JsonNullable email; + + @JsonCreator + public BrandLogos( + @JsonProperty("primary") JsonNullable primary, + @JsonProperty("secondary") JsonNullable secondary, + @JsonProperty("email") JsonNullable email) { + Utils.checkNotNull(primary, "primary"); + Utils.checkNotNull(secondary, "secondary"); + Utils.checkNotNull(email, "email"); + this.primary = primary; + this.secondary = secondary; + this.email = email; + } + + public BrandLogos() { + this(JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + @JsonIgnore + public JsonNullable primary() { + return primary; + } + + @JsonIgnore + public JsonNullable secondary() { + return secondary; + } + + @JsonIgnore + public JsonNullable email() { + return email; + } + + public static Builder builder() { + return new Builder(); + } + + + public BrandLogos withPrimary(String primary) { + Utils.checkNotNull(primary, "primary"); + this.primary = JsonNullable.of(primary); + return this; + } + + public BrandLogos withPrimary(JsonNullable primary) { + Utils.checkNotNull(primary, "primary"); + this.primary = primary; + return this; + } + + public BrandLogos withSecondary(String secondary) { + Utils.checkNotNull(secondary, "secondary"); + this.secondary = JsonNullable.of(secondary); + return this; + } + + public BrandLogos withSecondary(JsonNullable secondary) { + Utils.checkNotNull(secondary, "secondary"); + this.secondary = secondary; + return this; + } + + public BrandLogos withEmail(String email) { + Utils.checkNotNull(email, "email"); + this.email = JsonNullable.of(email); + return this; + } + + public BrandLogos withEmail(JsonNullable email) { + Utils.checkNotNull(email, "email"); + this.email = email; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrandLogos other = (BrandLogos) o; + return + Utils.enhancedDeepEquals(this.primary, other.primary) && + Utils.enhancedDeepEquals(this.secondary, other.secondary) && + Utils.enhancedDeepEquals(this.email, other.email); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + primary, secondary, email); + } + + @Override + public String toString() { + return Utils.toString(BrandLogos.class, + "primary", primary, + "secondary", secondary, + "email", email); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable primary = JsonNullable.undefined(); + + private JsonNullable secondary = JsonNullable.undefined(); + + private JsonNullable email = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + public Builder primary(String primary) { + Utils.checkNotNull(primary, "primary"); + this.primary = JsonNullable.of(primary); + return this; + } + + public Builder primary(JsonNullable primary) { + Utils.checkNotNull(primary, "primary"); + this.primary = primary; + return this; + } + + + public Builder secondary(String secondary) { + Utils.checkNotNull(secondary, "secondary"); + this.secondary = JsonNullable.of(secondary); + return this; + } + + public Builder secondary(JsonNullable secondary) { + Utils.checkNotNull(secondary, "secondary"); + this.secondary = secondary; + return this; + } + + + public Builder email(String email) { + Utils.checkNotNull(email, "email"); + this.email = JsonNullable.of(email); + return this; + } + + public Builder email(JsonNullable email) { + Utils.checkNotNull(email, "email"); + this.email = email; + return this; + } + + public BrandLogos build() { + + return new BrandLogos( + primary, secondary, email); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceBrandResponse.java b/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceBrandResponse.java new file mode 100644 index 0000000..597e207 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceBrandResponse.java @@ -0,0 +1,597 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Boolean; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.List; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * GetWorkspaceBrandResponse + * + *

The details of a single workspace brand + */ +public class GetWorkspaceBrandResponse { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_id") + private JsonNullable brandId; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_name") + private JsonNullable brandName; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_company") + private JsonNullable brandCompany; + + + @JsonInclude(Include.ALWAYS) + @JsonProperty("colors") + private Optional> colors; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("logos") + private Optional logos; + + + @JsonInclude(Include.ALWAYS) + @JsonProperty("brand_languages") + private Optional> brandLanguages; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("default_brand_language") + private JsonNullable defaultBrandLanguage; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("is_sending_default") + private Optional isSendingDefault; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("is_signing_default") + private Optional isSigningDefault; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("primary_logo_id") + private JsonNullable primaryLogoId; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("secondary_logo_id") + private JsonNullable secondaryLogoId; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("email_logo_id") + private JsonNullable emailLogoId; + + @JsonCreator + public GetWorkspaceBrandResponse( + @JsonProperty("brand_id") JsonNullable brandId, + @JsonProperty("brand_name") JsonNullable brandName, + @JsonProperty("brand_company") JsonNullable brandCompany, + @JsonProperty("colors") Optional> colors, + @JsonProperty("logos") Optional logos, + @JsonProperty("brand_languages") Optional> brandLanguages, + @JsonProperty("default_brand_language") JsonNullable defaultBrandLanguage, + @JsonProperty("is_sending_default") Optional isSendingDefault, + @JsonProperty("is_signing_default") Optional isSigningDefault, + @JsonProperty("primary_logo_id") JsonNullable primaryLogoId, + @JsonProperty("secondary_logo_id") JsonNullable secondaryLogoId, + @JsonProperty("email_logo_id") JsonNullable emailLogoId) { + Utils.checkNotNull(brandId, "brandId"); + Utils.checkNotNull(brandName, "brandName"); + Utils.checkNotNull(brandCompany, "brandCompany"); + Utils.checkNotNull(colors, "colors"); + Utils.checkNotNull(logos, "logos"); + Utils.checkNotNull(brandLanguages, "brandLanguages"); + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.brandId = brandId; + this.brandName = brandName; + this.brandCompany = brandCompany; + this.colors = colors; + this.logos = logos; + this.brandLanguages = brandLanguages; + this.defaultBrandLanguage = defaultBrandLanguage; + this.isSendingDefault = isSendingDefault; + this.isSigningDefault = isSigningDefault; + this.primaryLogoId = primaryLogoId; + this.secondaryLogoId = secondaryLogoId; + this.emailLogoId = emailLogoId; + } + + public GetWorkspaceBrandResponse() { + this(JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + @JsonIgnore + public JsonNullable brandId() { + return brandId; + } + + @JsonIgnore + public JsonNullable brandName() { + return brandName; + } + + @JsonIgnore + public JsonNullable brandCompany() { + return brandCompany; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> colors() { + return (Optional>) colors; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional logos() { + return (Optional) logos; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> brandLanguages() { + return (Optional>) brandLanguages; + } + + @JsonIgnore + public JsonNullable defaultBrandLanguage() { + return defaultBrandLanguage; + } + + @JsonIgnore + public Optional isSendingDefault() { + return isSendingDefault; + } + + @JsonIgnore + public Optional isSigningDefault() { + return isSigningDefault; + } + + @JsonIgnore + public JsonNullable primaryLogoId() { + return primaryLogoId; + } + + @JsonIgnore + public JsonNullable secondaryLogoId() { + return secondaryLogoId; + } + + @JsonIgnore + public JsonNullable emailLogoId() { + return emailLogoId; + } + + public static Builder builder() { + return new Builder(); + } + + + public GetWorkspaceBrandResponse withBrandId(String brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = JsonNullable.of(brandId); + return this; + } + + public GetWorkspaceBrandResponse withBrandId(JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + return this; + } + + public GetWorkspaceBrandResponse withBrandName(String brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = JsonNullable.of(brandName); + return this; + } + + public GetWorkspaceBrandResponse withBrandName(JsonNullable brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = brandName; + return this; + } + + public GetWorkspaceBrandResponse withBrandCompany(String brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = JsonNullable.of(brandCompany); + return this; + } + + public GetWorkspaceBrandResponse withBrandCompany(JsonNullable brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = brandCompany; + return this; + } + + public GetWorkspaceBrandResponse withColors(List colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = Optional.ofNullable(colors); + return this; + } + + + public GetWorkspaceBrandResponse withColors(Optional> colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = colors; + return this; + } + + public GetWorkspaceBrandResponse withLogos(BrandLogos logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = Optional.ofNullable(logos); + return this; + } + + + public GetWorkspaceBrandResponse withLogos(Optional logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = logos; + return this; + } + + public GetWorkspaceBrandResponse withBrandLanguages(List brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = Optional.ofNullable(brandLanguages); + return this; + } + + + public GetWorkspaceBrandResponse withBrandLanguages(Optional> brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = brandLanguages; + return this; + } + + public GetWorkspaceBrandResponse withDefaultBrandLanguage(String defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = JsonNullable.of(defaultBrandLanguage); + return this; + } + + public GetWorkspaceBrandResponse withDefaultBrandLanguage(JsonNullable defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = defaultBrandLanguage; + return this; + } + + public GetWorkspaceBrandResponse withIsSendingDefault(boolean isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = Optional.ofNullable(isSendingDefault); + return this; + } + + + public GetWorkspaceBrandResponse withIsSendingDefault(Optional isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = isSendingDefault; + return this; + } + + public GetWorkspaceBrandResponse withIsSigningDefault(boolean isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = Optional.ofNullable(isSigningDefault); + return this; + } + + + public GetWorkspaceBrandResponse withIsSigningDefault(Optional isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = isSigningDefault; + return this; + } + + public GetWorkspaceBrandResponse withPrimaryLogoId(String primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = JsonNullable.of(primaryLogoId); + return this; + } + + public GetWorkspaceBrandResponse withPrimaryLogoId(JsonNullable primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = primaryLogoId; + return this; + } + + public GetWorkspaceBrandResponse withSecondaryLogoId(String secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = JsonNullable.of(secondaryLogoId); + return this; + } + + public GetWorkspaceBrandResponse withSecondaryLogoId(JsonNullable secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = secondaryLogoId; + return this; + } + + public GetWorkspaceBrandResponse withEmailLogoId(String emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = JsonNullable.of(emailLogoId); + return this; + } + + public GetWorkspaceBrandResponse withEmailLogoId(JsonNullable emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = emailLogoId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWorkspaceBrandResponse other = (GetWorkspaceBrandResponse) o; + return + Utils.enhancedDeepEquals(this.brandId, other.brandId) && + Utils.enhancedDeepEquals(this.brandName, other.brandName) && + Utils.enhancedDeepEquals(this.brandCompany, other.brandCompany) && + Utils.enhancedDeepEquals(this.colors, other.colors) && + Utils.enhancedDeepEquals(this.logos, other.logos) && + Utils.enhancedDeepEquals(this.brandLanguages, other.brandLanguages) && + Utils.enhancedDeepEquals(this.defaultBrandLanguage, other.defaultBrandLanguage) && + Utils.enhancedDeepEquals(this.isSendingDefault, other.isSendingDefault) && + Utils.enhancedDeepEquals(this.isSigningDefault, other.isSigningDefault) && + Utils.enhancedDeepEquals(this.primaryLogoId, other.primaryLogoId) && + Utils.enhancedDeepEquals(this.secondaryLogoId, other.secondaryLogoId) && + Utils.enhancedDeepEquals(this.emailLogoId, other.emailLogoId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + brandId, brandName, brandCompany, + colors, logos, brandLanguages, + defaultBrandLanguage, isSendingDefault, isSigningDefault, + primaryLogoId, secondaryLogoId, emailLogoId); + } + + @Override + public String toString() { + return Utils.toString(GetWorkspaceBrandResponse.class, + "brandId", brandId, + "brandName", brandName, + "brandCompany", brandCompany, + "colors", colors, + "logos", logos, + "brandLanguages", brandLanguages, + "defaultBrandLanguage", defaultBrandLanguage, + "isSendingDefault", isSendingDefault, + "isSigningDefault", isSigningDefault, + "primaryLogoId", primaryLogoId, + "secondaryLogoId", secondaryLogoId, + "emailLogoId", emailLogoId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable brandId = JsonNullable.undefined(); + + private JsonNullable brandName = JsonNullable.undefined(); + + private JsonNullable brandCompany = JsonNullable.undefined(); + + private Optional> colors = Optional.empty(); + + private Optional logos = Optional.empty(); + + private Optional> brandLanguages = Optional.empty(); + + private JsonNullable defaultBrandLanguage = JsonNullable.undefined(); + + private Optional isSendingDefault = Optional.empty(); + + private Optional isSigningDefault = Optional.empty(); + + private JsonNullable primaryLogoId = JsonNullable.undefined(); + + private JsonNullable secondaryLogoId = JsonNullable.undefined(); + + private JsonNullable emailLogoId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + public Builder brandId(String brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = JsonNullable.of(brandId); + return this; + } + + public Builder brandId(JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + return this; + } + + + public Builder brandName(String brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = JsonNullable.of(brandName); + return this; + } + + public Builder brandName(JsonNullable brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = brandName; + return this; + } + + + public Builder brandCompany(String brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = JsonNullable.of(brandCompany); + return this; + } + + public Builder brandCompany(JsonNullable brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = brandCompany; + return this; + } + + + public Builder colors(List colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = Optional.ofNullable(colors); + return this; + } + + public Builder colors(Optional> colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = colors; + return this; + } + + + public Builder logos(BrandLogos logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = Optional.ofNullable(logos); + return this; + } + + public Builder logos(Optional logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = logos; + return this; + } + + + public Builder brandLanguages(List brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = Optional.ofNullable(brandLanguages); + return this; + } + + public Builder brandLanguages(Optional> brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = brandLanguages; + return this; + } + + + public Builder defaultBrandLanguage(String defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = JsonNullable.of(defaultBrandLanguage); + return this; + } + + public Builder defaultBrandLanguage(JsonNullable defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = defaultBrandLanguage; + return this; + } + + + public Builder isSendingDefault(boolean isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = Optional.ofNullable(isSendingDefault); + return this; + } + + public Builder isSendingDefault(Optional isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = isSendingDefault; + return this; + } + + + public Builder isSigningDefault(boolean isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = Optional.ofNullable(isSigningDefault); + return this; + } + + public Builder isSigningDefault(Optional isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = isSigningDefault; + return this; + } + + + public Builder primaryLogoId(String primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = JsonNullable.of(primaryLogoId); + return this; + } + + public Builder primaryLogoId(JsonNullable primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = primaryLogoId; + return this; + } + + + public Builder secondaryLogoId(String secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = JsonNullable.of(secondaryLogoId); + return this; + } + + public Builder secondaryLogoId(JsonNullable secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = secondaryLogoId; + return this; + } + + + public Builder emailLogoId(String emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = JsonNullable.of(emailLogoId); + return this; + } + + public Builder emailLogoId(JsonNullable emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = emailLogoId; + return this; + } + + public GetWorkspaceBrandResponse build() { + + return new GetWorkspaceBrandResponse( + brandId, brandName, brandCompany, + colors, logos, brandLanguages, + defaultBrandLanguage, isSendingDefault, isSigningDefault, + primaryLogoId, secondaryLogoId, emailLogoId); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceUploadRequestResponse.java b/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceUploadRequestResponse.java index 45efeed..193f74b 100644 --- a/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceUploadRequestResponse.java +++ b/src/main/java/com/docusign/iam/sdk/models/components/GetWorkspaceUploadRequestResponse.java @@ -77,14 +77,16 @@ public class GetWorkspaceUploadRequestResponse { /** * The date the upload request was created */ + @JsonInclude(Include.ALWAYS) @JsonProperty("created_date") - private OffsetDateTime createdDate; + private Optional createdDate; /** * The date the upload request was last updated */ + @JsonInclude(Include.ALWAYS) @JsonProperty("updated_date") - private OffsetDateTime updatedDate; + private Optional updatedDate; /** * The due date for the upload request @@ -135,8 +137,8 @@ public GetWorkspaceUploadRequestResponse( @JsonProperty("status") WorkspaceUploadRequestStatus status, @JsonProperty("documents") Optional> documents, @JsonProperty("assignments") Optional> assignments, - @JsonProperty("created_date") OffsetDateTime createdDate, - @JsonProperty("updated_date") OffsetDateTime updatedDate, + @JsonProperty("created_date") Optional createdDate, + @JsonProperty("updated_date") Optional updatedDate, @JsonProperty("due_date") JsonNullable dueDate, @JsonProperty("sent_date") JsonNullable sentDate, @JsonProperty("completed_date") JsonNullable completedDate, @@ -182,15 +184,13 @@ public GetWorkspaceUploadRequestResponse( String workspaceId, WorkspaceUploadRequestOwner uploadRequestOwner, WorkspaceUploadRequestStatus status, - OffsetDateTime createdDate, - OffsetDateTime updatedDate, boolean canView, boolean canEdit, boolean canDelete) { this(uploadRequestId, workspaceId, Optional.empty(), JsonNullable.undefined(), uploadRequestOwner, status, - Optional.empty(), Optional.empty(), createdDate, - updatedDate, JsonNullable.undefined(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), canView, canEdit, canDelete); } @@ -262,7 +262,7 @@ public Optional> assignments() { * The date the upload request was created */ @JsonIgnore - public OffsetDateTime createdDate() { + public Optional createdDate() { return createdDate; } @@ -270,7 +270,7 @@ public OffsetDateTime createdDate() { * The date the upload request was last updated */ @JsonIgnore - public OffsetDateTime updatedDate() { + public Optional updatedDate() { return updatedDate; } @@ -439,6 +439,16 @@ public GetWorkspaceUploadRequestResponse withAssignments(Optional createdDate) { Utils.checkNotNull(createdDate, "createdDate"); this.createdDate = createdDate; return this; @@ -448,6 +458,16 @@ public GetWorkspaceUploadRequestResponse withCreatedDate(OffsetDateTime createdD * The date the upload request was last updated */ public GetWorkspaceUploadRequestResponse withUpdatedDate(OffsetDateTime updatedDate) { + Utils.checkNotNull(updatedDate, "updatedDate"); + this.updatedDate = Optional.ofNullable(updatedDate); + return this; + } + + + /** + * The date the upload request was last updated + */ + public GetWorkspaceUploadRequestResponse withUpdatedDate(Optional updatedDate) { Utils.checkNotNull(updatedDate, "updatedDate"); this.updatedDate = updatedDate; return this; @@ -613,9 +633,9 @@ public final static class Builder { private Optional> assignments = Optional.empty(); - private OffsetDateTime createdDate; + private Optional createdDate = Optional.empty(); - private OffsetDateTime updatedDate; + private Optional updatedDate = Optional.empty(); private JsonNullable dueDate = JsonNullable.undefined(); @@ -751,6 +771,15 @@ public Builder assignments(Optional createdDate) { Utils.checkNotNull(createdDate, "createdDate"); this.createdDate = createdDate; return this; @@ -761,6 +790,15 @@ public Builder createdDate(OffsetDateTime createdDate) { * The date the upload request was last updated */ public Builder updatedDate(OffsetDateTime updatedDate) { + Utils.checkNotNull(updatedDate, "updatedDate"); + this.updatedDate = Optional.ofNullable(updatedDate); + return this; + } + + /** + * The date the upload request was last updated + */ + public Builder updatedDate(Optional updatedDate) { Utils.checkNotNull(updatedDate, "updatedDate"); this.updatedDate = updatedDate; return this; diff --git a/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBody.java b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBody.java new file mode 100644 index 0000000..cc987f5 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBody.java @@ -0,0 +1,128 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Override; +import java.lang.String; +import java.util.Optional; + + +public class UpdateWorkspaceBody { + /** + * The updated name of the workspace + */ + @JsonInclude(Include.ALWAYS) + @JsonProperty("name") + private Optional name; + + @JsonCreator + public UpdateWorkspaceBody( + @JsonProperty("name") Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + } + + public UpdateWorkspaceBody() { + this(Optional.empty()); + } + + /** + * The updated name of the workspace + */ + @JsonIgnore + public Optional name() { + return name; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The updated name of the workspace + */ + public UpdateWorkspaceBody withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + + /** + * The updated name of the workspace + */ + public UpdateWorkspaceBody withName(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceBody other = (UpdateWorkspaceBody) o; + return + Utils.enhancedDeepEquals(this.name, other.name); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + name); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceBody.class, + "name", name); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional name = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The updated name of the workspace + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + /** + * The updated name of the workspace + */ + public Builder name(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + public UpdateWorkspaceBody build() { + + return new UpdateWorkspaceBody( + name); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBrandBody.java b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBrandBody.java new file mode 100644 index 0000000..a1800cd --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBrandBody.java @@ -0,0 +1,133 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Override; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class UpdateWorkspaceBrandBody { + /** + * A GUID value that identifies a brand. For more information, see Branding + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_id") + private JsonNullable brandId; + + @JsonCreator + public UpdateWorkspaceBrandBody( + @JsonProperty("brand_id") JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + } + + public UpdateWorkspaceBrandBody() { + this(JsonNullable.undefined()); + } + + /** + * A GUID value that identifies a brand. For more information, see Branding + */ + @JsonIgnore + public JsonNullable brandId() { + return brandId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * A GUID value that identifies a brand. For more information, see Branding + */ + public UpdateWorkspaceBrandBody withBrandId(String brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = JsonNullable.of(brandId); + return this; + } + + /** + * A GUID value that identifies a brand. For more information, see Branding + */ + public UpdateWorkspaceBrandBody withBrandId(JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceBrandBody other = (UpdateWorkspaceBrandBody) o; + return + Utils.enhancedDeepEquals(this.brandId, other.brandId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + brandId); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceBrandBody.class, + "brandId", brandId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable brandId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + /** + * A GUID value that identifies a brand. For more information, see Branding + */ + public Builder brandId(String brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = JsonNullable.of(brandId); + return this; + } + + /** + * A GUID value that identifies a brand. For more information, see Branding + */ + public Builder brandId(JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + return this; + } + + public UpdateWorkspaceBrandBody build() { + + return new UpdateWorkspaceBrandBody( + brandId); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBrandResponse.java b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBrandResponse.java new file mode 100644 index 0000000..573949b --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceBrandResponse.java @@ -0,0 +1,597 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Boolean; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.List; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * UpdateWorkspaceBrandResponse + * + *

The brand details set for a workspace + */ +public class UpdateWorkspaceBrandResponse { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_id") + private JsonNullable brandId; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_name") + private JsonNullable brandName; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("brand_company") + private JsonNullable brandCompany; + + + @JsonInclude(Include.ALWAYS) + @JsonProperty("colors") + private Optional> colors; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("logos") + private Optional logos; + + + @JsonInclude(Include.ALWAYS) + @JsonProperty("brand_languages") + private Optional> brandLanguages; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("default_brand_language") + private JsonNullable defaultBrandLanguage; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("is_sending_default") + private Optional isSendingDefault; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("is_signing_default") + private Optional isSigningDefault; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("primary_logo_id") + private JsonNullable primaryLogoId; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("secondary_logo_id") + private JsonNullable secondaryLogoId; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("email_logo_id") + private JsonNullable emailLogoId; + + @JsonCreator + public UpdateWorkspaceBrandResponse( + @JsonProperty("brand_id") JsonNullable brandId, + @JsonProperty("brand_name") JsonNullable brandName, + @JsonProperty("brand_company") JsonNullable brandCompany, + @JsonProperty("colors") Optional> colors, + @JsonProperty("logos") Optional logos, + @JsonProperty("brand_languages") Optional> brandLanguages, + @JsonProperty("default_brand_language") JsonNullable defaultBrandLanguage, + @JsonProperty("is_sending_default") Optional isSendingDefault, + @JsonProperty("is_signing_default") Optional isSigningDefault, + @JsonProperty("primary_logo_id") JsonNullable primaryLogoId, + @JsonProperty("secondary_logo_id") JsonNullable secondaryLogoId, + @JsonProperty("email_logo_id") JsonNullable emailLogoId) { + Utils.checkNotNull(brandId, "brandId"); + Utils.checkNotNull(brandName, "brandName"); + Utils.checkNotNull(brandCompany, "brandCompany"); + Utils.checkNotNull(colors, "colors"); + Utils.checkNotNull(logos, "logos"); + Utils.checkNotNull(brandLanguages, "brandLanguages"); + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.brandId = brandId; + this.brandName = brandName; + this.brandCompany = brandCompany; + this.colors = colors; + this.logos = logos; + this.brandLanguages = brandLanguages; + this.defaultBrandLanguage = defaultBrandLanguage; + this.isSendingDefault = isSendingDefault; + this.isSigningDefault = isSigningDefault; + this.primaryLogoId = primaryLogoId; + this.secondaryLogoId = secondaryLogoId; + this.emailLogoId = emailLogoId; + } + + public UpdateWorkspaceBrandResponse() { + this(JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + @JsonIgnore + public JsonNullable brandId() { + return brandId; + } + + @JsonIgnore + public JsonNullable brandName() { + return brandName; + } + + @JsonIgnore + public JsonNullable brandCompany() { + return brandCompany; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> colors() { + return (Optional>) colors; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional logos() { + return (Optional) logos; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> brandLanguages() { + return (Optional>) brandLanguages; + } + + @JsonIgnore + public JsonNullable defaultBrandLanguage() { + return defaultBrandLanguage; + } + + @JsonIgnore + public Optional isSendingDefault() { + return isSendingDefault; + } + + @JsonIgnore + public Optional isSigningDefault() { + return isSigningDefault; + } + + @JsonIgnore + public JsonNullable primaryLogoId() { + return primaryLogoId; + } + + @JsonIgnore + public JsonNullable secondaryLogoId() { + return secondaryLogoId; + } + + @JsonIgnore + public JsonNullable emailLogoId() { + return emailLogoId; + } + + public static Builder builder() { + return new Builder(); + } + + + public UpdateWorkspaceBrandResponse withBrandId(String brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = JsonNullable.of(brandId); + return this; + } + + public UpdateWorkspaceBrandResponse withBrandId(JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + return this; + } + + public UpdateWorkspaceBrandResponse withBrandName(String brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = JsonNullable.of(brandName); + return this; + } + + public UpdateWorkspaceBrandResponse withBrandName(JsonNullable brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = brandName; + return this; + } + + public UpdateWorkspaceBrandResponse withBrandCompany(String brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = JsonNullable.of(brandCompany); + return this; + } + + public UpdateWorkspaceBrandResponse withBrandCompany(JsonNullable brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = brandCompany; + return this; + } + + public UpdateWorkspaceBrandResponse withColors(List colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = Optional.ofNullable(colors); + return this; + } + + + public UpdateWorkspaceBrandResponse withColors(Optional> colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = colors; + return this; + } + + public UpdateWorkspaceBrandResponse withLogos(BrandLogos logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = Optional.ofNullable(logos); + return this; + } + + + public UpdateWorkspaceBrandResponse withLogos(Optional logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = logos; + return this; + } + + public UpdateWorkspaceBrandResponse withBrandLanguages(List brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = Optional.ofNullable(brandLanguages); + return this; + } + + + public UpdateWorkspaceBrandResponse withBrandLanguages(Optional> brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = brandLanguages; + return this; + } + + public UpdateWorkspaceBrandResponse withDefaultBrandLanguage(String defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = JsonNullable.of(defaultBrandLanguage); + return this; + } + + public UpdateWorkspaceBrandResponse withDefaultBrandLanguage(JsonNullable defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = defaultBrandLanguage; + return this; + } + + public UpdateWorkspaceBrandResponse withIsSendingDefault(boolean isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = Optional.ofNullable(isSendingDefault); + return this; + } + + + public UpdateWorkspaceBrandResponse withIsSendingDefault(Optional isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = isSendingDefault; + return this; + } + + public UpdateWorkspaceBrandResponse withIsSigningDefault(boolean isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = Optional.ofNullable(isSigningDefault); + return this; + } + + + public UpdateWorkspaceBrandResponse withIsSigningDefault(Optional isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = isSigningDefault; + return this; + } + + public UpdateWorkspaceBrandResponse withPrimaryLogoId(String primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = JsonNullable.of(primaryLogoId); + return this; + } + + public UpdateWorkspaceBrandResponse withPrimaryLogoId(JsonNullable primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = primaryLogoId; + return this; + } + + public UpdateWorkspaceBrandResponse withSecondaryLogoId(String secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = JsonNullable.of(secondaryLogoId); + return this; + } + + public UpdateWorkspaceBrandResponse withSecondaryLogoId(JsonNullable secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = secondaryLogoId; + return this; + } + + public UpdateWorkspaceBrandResponse withEmailLogoId(String emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = JsonNullable.of(emailLogoId); + return this; + } + + public UpdateWorkspaceBrandResponse withEmailLogoId(JsonNullable emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = emailLogoId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceBrandResponse other = (UpdateWorkspaceBrandResponse) o; + return + Utils.enhancedDeepEquals(this.brandId, other.brandId) && + Utils.enhancedDeepEquals(this.brandName, other.brandName) && + Utils.enhancedDeepEquals(this.brandCompany, other.brandCompany) && + Utils.enhancedDeepEquals(this.colors, other.colors) && + Utils.enhancedDeepEquals(this.logos, other.logos) && + Utils.enhancedDeepEquals(this.brandLanguages, other.brandLanguages) && + Utils.enhancedDeepEquals(this.defaultBrandLanguage, other.defaultBrandLanguage) && + Utils.enhancedDeepEquals(this.isSendingDefault, other.isSendingDefault) && + Utils.enhancedDeepEquals(this.isSigningDefault, other.isSigningDefault) && + Utils.enhancedDeepEquals(this.primaryLogoId, other.primaryLogoId) && + Utils.enhancedDeepEquals(this.secondaryLogoId, other.secondaryLogoId) && + Utils.enhancedDeepEquals(this.emailLogoId, other.emailLogoId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + brandId, brandName, brandCompany, + colors, logos, brandLanguages, + defaultBrandLanguage, isSendingDefault, isSigningDefault, + primaryLogoId, secondaryLogoId, emailLogoId); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceBrandResponse.class, + "brandId", brandId, + "brandName", brandName, + "brandCompany", brandCompany, + "colors", colors, + "logos", logos, + "brandLanguages", brandLanguages, + "defaultBrandLanguage", defaultBrandLanguage, + "isSendingDefault", isSendingDefault, + "isSigningDefault", isSigningDefault, + "primaryLogoId", primaryLogoId, + "secondaryLogoId", secondaryLogoId, + "emailLogoId", emailLogoId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable brandId = JsonNullable.undefined(); + + private JsonNullable brandName = JsonNullable.undefined(); + + private JsonNullable brandCompany = JsonNullable.undefined(); + + private Optional> colors = Optional.empty(); + + private Optional logos = Optional.empty(); + + private Optional> brandLanguages = Optional.empty(); + + private JsonNullable defaultBrandLanguage = JsonNullable.undefined(); + + private Optional isSendingDefault = Optional.empty(); + + private Optional isSigningDefault = Optional.empty(); + + private JsonNullable primaryLogoId = JsonNullable.undefined(); + + private JsonNullable secondaryLogoId = JsonNullable.undefined(); + + private JsonNullable emailLogoId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + public Builder brandId(String brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = JsonNullable.of(brandId); + return this; + } + + public Builder brandId(JsonNullable brandId) { + Utils.checkNotNull(brandId, "brandId"); + this.brandId = brandId; + return this; + } + + + public Builder brandName(String brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = JsonNullable.of(brandName); + return this; + } + + public Builder brandName(JsonNullable brandName) { + Utils.checkNotNull(brandName, "brandName"); + this.brandName = brandName; + return this; + } + + + public Builder brandCompany(String brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = JsonNullable.of(brandCompany); + return this; + } + + public Builder brandCompany(JsonNullable brandCompany) { + Utils.checkNotNull(brandCompany, "brandCompany"); + this.brandCompany = brandCompany; + return this; + } + + + public Builder colors(List colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = Optional.ofNullable(colors); + return this; + } + + public Builder colors(Optional> colors) { + Utils.checkNotNull(colors, "colors"); + this.colors = colors; + return this; + } + + + public Builder logos(BrandLogos logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = Optional.ofNullable(logos); + return this; + } + + public Builder logos(Optional logos) { + Utils.checkNotNull(logos, "logos"); + this.logos = logos; + return this; + } + + + public Builder brandLanguages(List brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = Optional.ofNullable(brandLanguages); + return this; + } + + public Builder brandLanguages(Optional> brandLanguages) { + Utils.checkNotNull(brandLanguages, "brandLanguages"); + this.brandLanguages = brandLanguages; + return this; + } + + + public Builder defaultBrandLanguage(String defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = JsonNullable.of(defaultBrandLanguage); + return this; + } + + public Builder defaultBrandLanguage(JsonNullable defaultBrandLanguage) { + Utils.checkNotNull(defaultBrandLanguage, "defaultBrandLanguage"); + this.defaultBrandLanguage = defaultBrandLanguage; + return this; + } + + + public Builder isSendingDefault(boolean isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = Optional.ofNullable(isSendingDefault); + return this; + } + + public Builder isSendingDefault(Optional isSendingDefault) { + Utils.checkNotNull(isSendingDefault, "isSendingDefault"); + this.isSendingDefault = isSendingDefault; + return this; + } + + + public Builder isSigningDefault(boolean isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = Optional.ofNullable(isSigningDefault); + return this; + } + + public Builder isSigningDefault(Optional isSigningDefault) { + Utils.checkNotNull(isSigningDefault, "isSigningDefault"); + this.isSigningDefault = isSigningDefault; + return this; + } + + + public Builder primaryLogoId(String primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = JsonNullable.of(primaryLogoId); + return this; + } + + public Builder primaryLogoId(JsonNullable primaryLogoId) { + Utils.checkNotNull(primaryLogoId, "primaryLogoId"); + this.primaryLogoId = primaryLogoId; + return this; + } + + + public Builder secondaryLogoId(String secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = JsonNullable.of(secondaryLogoId); + return this; + } + + public Builder secondaryLogoId(JsonNullable secondaryLogoId) { + Utils.checkNotNull(secondaryLogoId, "secondaryLogoId"); + this.secondaryLogoId = secondaryLogoId; + return this; + } + + + public Builder emailLogoId(String emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = JsonNullable.of(emailLogoId); + return this; + } + + public Builder emailLogoId(JsonNullable emailLogoId) { + Utils.checkNotNull(emailLogoId, "emailLogoId"); + this.emailLogoId = emailLogoId; + return this; + } + + public UpdateWorkspaceBrandResponse build() { + + return new UpdateWorkspaceBrandResponse( + brandId, brandName, brandCompany, + colors, logos, brandLanguages, + defaultBrandLanguage, isSendingDefault, isSigningDefault, + primaryLogoId, secondaryLogoId, emailLogoId); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceResponse.java b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceResponse.java new file mode 100644 index 0000000..8192289 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceResponse.java @@ -0,0 +1,356 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.components; + +import com.docusign.iam.sdk.utils.Utils; +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 java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.time.OffsetDateTime; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * UpdateWorkspaceResponse + * + *

The details of a single workspace + */ +public class UpdateWorkspaceResponse { + /** + * The ID of the workspace + */ + @JsonProperty("workspace_id") + private String workspaceId; + + /** + * The name of the workspace + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private JsonNullable name; + + /** + * The date the workspace was created + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("created_date") + private JsonNullable createdDate; + + /** + * The ID of the user who created the workspace + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("created_by_user_id") + private JsonNullable createdByUserId; + + /** + * The list of user IDs of the workspace owners + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("workspace_owner_ids") + private JsonNullable> workspaceOwnerIds; + + @JsonCreator + public UpdateWorkspaceResponse( + @JsonProperty("workspace_id") String workspaceId, + @JsonProperty("name") JsonNullable name, + @JsonProperty("created_date") JsonNullable createdDate, + @JsonProperty("created_by_user_id") JsonNullable createdByUserId, + @JsonProperty("workspace_owner_ids") JsonNullable> workspaceOwnerIds) { + Utils.checkNotNull(workspaceId, "workspaceId"); + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(createdDate, "createdDate"); + Utils.checkNotNull(createdByUserId, "createdByUserId"); + Utils.checkNotNull(workspaceOwnerIds, "workspaceOwnerIds"); + this.workspaceId = workspaceId; + this.name = name; + this.createdDate = createdDate; + this.createdByUserId = createdByUserId; + this.workspaceOwnerIds = workspaceOwnerIds; + } + + public UpdateWorkspaceResponse( + String workspaceId) { + this(workspaceId, JsonNullable.undefined(), JsonNullable.undefined(), + JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * The ID of the workspace + */ + @JsonIgnore + public String workspaceId() { + return workspaceId; + } + + /** + * The name of the workspace + */ + @JsonIgnore + public JsonNullable name() { + return name; + } + + /** + * The date the workspace was created + */ + @JsonIgnore + public JsonNullable createdDate() { + return createdDate; + } + + /** + * The ID of the user who created the workspace + */ + @JsonIgnore + public JsonNullable createdByUserId() { + return createdByUserId; + } + + /** + * The list of user IDs of the workspace owners + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> workspaceOwnerIds() { + return (JsonNullable>) workspaceOwnerIds; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The ID of the workspace + */ + public UpdateWorkspaceResponse withWorkspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + /** + * The name of the workspace + */ + public UpdateWorkspaceResponse withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + /** + * The name of the workspace + */ + public UpdateWorkspaceResponse withName(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The date the workspace was created + */ + public UpdateWorkspaceResponse withCreatedDate(OffsetDateTime createdDate) { + Utils.checkNotNull(createdDate, "createdDate"); + this.createdDate = JsonNullable.of(createdDate); + return this; + } + + /** + * The date the workspace was created + */ + public UpdateWorkspaceResponse withCreatedDate(JsonNullable createdDate) { + Utils.checkNotNull(createdDate, "createdDate"); + this.createdDate = createdDate; + return this; + } + + /** + * The ID of the user who created the workspace + */ + public UpdateWorkspaceResponse withCreatedByUserId(String createdByUserId) { + Utils.checkNotNull(createdByUserId, "createdByUserId"); + this.createdByUserId = JsonNullable.of(createdByUserId); + return this; + } + + /** + * The ID of the user who created the workspace + */ + public UpdateWorkspaceResponse withCreatedByUserId(JsonNullable createdByUserId) { + Utils.checkNotNull(createdByUserId, "createdByUserId"); + this.createdByUserId = createdByUserId; + return this; + } + + /** + * The list of user IDs of the workspace owners + */ + public UpdateWorkspaceResponse withWorkspaceOwnerIds(List workspaceOwnerIds) { + Utils.checkNotNull(workspaceOwnerIds, "workspaceOwnerIds"); + this.workspaceOwnerIds = JsonNullable.of(workspaceOwnerIds); + return this; + } + + /** + * The list of user IDs of the workspace owners + */ + public UpdateWorkspaceResponse withWorkspaceOwnerIds(JsonNullable> workspaceOwnerIds) { + Utils.checkNotNull(workspaceOwnerIds, "workspaceOwnerIds"); + this.workspaceOwnerIds = workspaceOwnerIds; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceResponse other = (UpdateWorkspaceResponse) o; + return + Utils.enhancedDeepEquals(this.workspaceId, other.workspaceId) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.createdDate, other.createdDate) && + Utils.enhancedDeepEquals(this.createdByUserId, other.createdByUserId) && + Utils.enhancedDeepEquals(this.workspaceOwnerIds, other.workspaceOwnerIds); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + workspaceId, name, createdDate, + createdByUserId, workspaceOwnerIds); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceResponse.class, + "workspaceId", workspaceId, + "name", name, + "createdDate", createdDate, + "createdByUserId", createdByUserId, + "workspaceOwnerIds", workspaceOwnerIds); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String workspaceId; + + private JsonNullable name = JsonNullable.undefined(); + + private JsonNullable createdDate = JsonNullable.undefined(); + + private JsonNullable createdByUserId = JsonNullable.undefined(); + + private JsonNullable> workspaceOwnerIds = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The ID of the workspace + */ + public Builder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + + /** + * The name of the workspace + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + /** + * The name of the workspace + */ + public Builder name(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + + /** + * The date the workspace was created + */ + public Builder createdDate(OffsetDateTime createdDate) { + Utils.checkNotNull(createdDate, "createdDate"); + this.createdDate = JsonNullable.of(createdDate); + return this; + } + + /** + * The date the workspace was created + */ + public Builder createdDate(JsonNullable createdDate) { + Utils.checkNotNull(createdDate, "createdDate"); + this.createdDate = createdDate; + return this; + } + + + /** + * The ID of the user who created the workspace + */ + public Builder createdByUserId(String createdByUserId) { + Utils.checkNotNull(createdByUserId, "createdByUserId"); + this.createdByUserId = JsonNullable.of(createdByUserId); + return this; + } + + /** + * The ID of the user who created the workspace + */ + public Builder createdByUserId(JsonNullable createdByUserId) { + Utils.checkNotNull(createdByUserId, "createdByUserId"); + this.createdByUserId = createdByUserId; + return this; + } + + + /** + * The list of user IDs of the workspace owners + */ + public Builder workspaceOwnerIds(List workspaceOwnerIds) { + Utils.checkNotNull(workspaceOwnerIds, "workspaceOwnerIds"); + this.workspaceOwnerIds = JsonNullable.of(workspaceOwnerIds); + return this; + } + + /** + * The list of user IDs of the workspace owners + */ + public Builder workspaceOwnerIds(JsonNullable> workspaceOwnerIds) { + Utils.checkNotNull(workspaceOwnerIds, "workspaceOwnerIds"); + this.workspaceOwnerIds = workspaceOwnerIds; + return this; + } + + public UpdateWorkspaceResponse build() { + + return new UpdateWorkspaceResponse( + workspaceId, name, createdDate, + createdByUserId, workspaceOwnerIds); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceUploadRequestBody.java b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceUploadRequestBody.java index 2279dc5..f78ed35 100644 --- a/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceUploadRequestBody.java +++ b/src/main/java/com/docusign/iam/sdk/models/components/UpdateWorkspaceUploadRequestBody.java @@ -13,6 +13,7 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; +import java.time.OffsetDateTime; import java.util.List; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; @@ -93,9 +94,8 @@ public class UpdateWorkspaceUploadRequestBody { /** * The due date for the upload request (editable) */ - @JsonInclude(Include.ALWAYS) @JsonProperty("due_date") - private Optional dueDate; + private OffsetDateTime dueDate; /** * The date the upload request was sent @@ -144,7 +144,7 @@ public UpdateWorkspaceUploadRequestBody( @JsonProperty("assignments") JsonNullable> assignments, @JsonProperty("created_date") JsonNullable createdDate, @JsonProperty("updated_date") JsonNullable updatedDate, - @JsonProperty("due_date") Optional dueDate, + @JsonProperty("due_date") OffsetDateTime dueDate, @JsonProperty("sent_date") JsonNullable sentDate, @JsonProperty("completed_date") JsonNullable completedDate, @JsonProperty("can_view") JsonNullable canView, @@ -185,11 +185,12 @@ public UpdateWorkspaceUploadRequestBody( } public UpdateWorkspaceUploadRequestBody( - WorkspaceUploadRequestStatus status) { + WorkspaceUploadRequestStatus status, + OffsetDateTime dueDate) { this(JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), status, JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), - JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined(), + JsonNullable.undefined(), dueDate, JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); } @@ -278,7 +279,7 @@ public JsonNullable updatedDate() { * The due date for the upload request (editable) */ @JsonIgnore - public Optional dueDate() { + public OffsetDateTime dueDate() { return dueDate; } @@ -498,17 +499,7 @@ public UpdateWorkspaceUploadRequestBody withUpdatedDate(JsonNullable upd /** * The due date for the upload request (editable) */ - public UpdateWorkspaceUploadRequestBody withDueDate(String dueDate) { - Utils.checkNotNull(dueDate, "dueDate"); - this.dueDate = Optional.ofNullable(dueDate); - return this; - } - - - /** - * The due date for the upload request (editable) - */ - public UpdateWorkspaceUploadRequestBody withDueDate(Optional dueDate) { + public UpdateWorkspaceUploadRequestBody withDueDate(OffsetDateTime dueDate) { Utils.checkNotNull(dueDate, "dueDate"); this.dueDate = dueDate; return this; @@ -687,7 +678,7 @@ public final static class Builder { private JsonNullable updatedDate = JsonNullable.undefined(); - private Optional dueDate = Optional.empty(); + private OffsetDateTime dueDate; private JsonNullable sentDate = JsonNullable.undefined(); @@ -882,16 +873,7 @@ public Builder updatedDate(JsonNullable updatedDate) { /** * The due date for the upload request (editable) */ - public Builder dueDate(String dueDate) { - Utils.checkNotNull(dueDate, "dueDate"); - this.dueDate = Optional.ofNullable(dueDate); - return this; - } - - /** - * The due date for the upload request (editable) - */ - public Builder dueDate(Optional dueDate) { + public Builder dueDate(OffsetDateTime dueDate) { Utils.checkNotNull(dueDate, "dueDate"); this.dueDate = dueDate; return this; diff --git a/src/main/java/com/docusign/iam/sdk/models/components/WorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/models/components/WorkspaceUploadRequest.java index 4e680cc..6fc3a96 100644 --- a/src/main/java/com/docusign/iam/sdk/models/components/WorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/models/components/WorkspaceUploadRequest.java @@ -73,14 +73,16 @@ public class WorkspaceUploadRequest { /** * The date the upload request was created */ + @JsonInclude(Include.ALWAYS) @JsonProperty("created_date") - private OffsetDateTime createdDate; + private Optional createdDate; /** * The date the upload request was last updated */ + @JsonInclude(Include.ALWAYS) @JsonProperty("updated_date") - private OffsetDateTime updatedDate; + private Optional updatedDate; /** * The due date for the upload request @@ -131,8 +133,8 @@ public WorkspaceUploadRequest( @JsonProperty("status") WorkspaceUploadRequestStatus status, @JsonProperty("documents") Optional> documents, @JsonProperty("assignments") Optional> assignments, - @JsonProperty("created_date") OffsetDateTime createdDate, - @JsonProperty("updated_date") OffsetDateTime updatedDate, + @JsonProperty("created_date") Optional createdDate, + @JsonProperty("updated_date") Optional updatedDate, @JsonProperty("due_date") JsonNullable dueDate, @JsonProperty("sent_date") JsonNullable sentDate, @JsonProperty("completed_date") JsonNullable completedDate, @@ -178,15 +180,13 @@ public WorkspaceUploadRequest( String workspaceId, WorkspaceUploadRequestOwner uploadRequestOwner, WorkspaceUploadRequestStatus status, - OffsetDateTime createdDate, - OffsetDateTime updatedDate, boolean canView, boolean canEdit, boolean canDelete) { this(uploadRequestId, workspaceId, Optional.empty(), JsonNullable.undefined(), uploadRequestOwner, status, - Optional.empty(), Optional.empty(), createdDate, - updatedDate, JsonNullable.undefined(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), canView, canEdit, canDelete); } @@ -258,7 +258,7 @@ public Optional> assignments() { * The date the upload request was created */ @JsonIgnore - public OffsetDateTime createdDate() { + public Optional createdDate() { return createdDate; } @@ -266,7 +266,7 @@ public OffsetDateTime createdDate() { * The date the upload request was last updated */ @JsonIgnore - public OffsetDateTime updatedDate() { + public Optional updatedDate() { return updatedDate; } @@ -435,6 +435,16 @@ public WorkspaceUploadRequest withAssignments(Optional createdDate) { Utils.checkNotNull(createdDate, "createdDate"); this.createdDate = createdDate; return this; @@ -444,6 +454,16 @@ public WorkspaceUploadRequest withCreatedDate(OffsetDateTime createdDate) { * The date the upload request was last updated */ public WorkspaceUploadRequest withUpdatedDate(OffsetDateTime updatedDate) { + Utils.checkNotNull(updatedDate, "updatedDate"); + this.updatedDate = Optional.ofNullable(updatedDate); + return this; + } + + + /** + * The date the upload request was last updated + */ + public WorkspaceUploadRequest withUpdatedDate(Optional updatedDate) { Utils.checkNotNull(updatedDate, "updatedDate"); this.updatedDate = updatedDate; return this; @@ -609,9 +629,9 @@ public final static class Builder { private Optional> assignments = Optional.empty(); - private OffsetDateTime createdDate; + private Optional createdDate = Optional.empty(); - private OffsetDateTime updatedDate; + private Optional updatedDate = Optional.empty(); private JsonNullable dueDate = JsonNullable.undefined(); @@ -747,6 +767,15 @@ public Builder assignments(Optional createdDate) { Utils.checkNotNull(createdDate, "createdDate"); this.createdDate = createdDate; return this; @@ -757,6 +786,15 @@ public Builder createdDate(OffsetDateTime createdDate) { * The date the upload request was last updated */ public Builder updatedDate(OffsetDateTime updatedDate) { + Utils.checkNotNull(updatedDate, "updatedDate"); + this.updatedDate = Optional.ofNullable(updatedDate); + return this; + } + + /** + * The date the upload request was last updated + */ + public Builder updatedDate(Optional updatedDate) { Utils.checkNotNull(updatedDate, "updatedDate"); this.updatedDate = updatedDate; return this; diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/APIException.java b/src/main/java/com/docusign/iam/sdk/models/errors/APIException.java index c4c06f7..9b89aa9 100644 --- a/src/main/java/com/docusign/iam/sdk/models/errors/APIException.java +++ b/src/main/java/com/docusign/iam/sdk/models/errors/APIException.java @@ -3,90 +3,47 @@ */ package com.docusign.iam.sdk.models.errors; +import jakarta.annotation.Nullable; +import com.docusign.iam.sdk.utils.Utils; + +import java.io.IOException; import java.net.http.HttpResponse; import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import com.docusign.iam.sdk.utils.Utils; /** * Thrown by a service call when an error response occurs. Contains details about the response. */ @SuppressWarnings("serial") -public class APIException extends Exception { - - private final HttpResponse rawResponse; - private final int code; - private final String message; - private final byte[] body; +public class APIException extends IamClientError { public APIException( - HttpResponse rawResponse, - int code, String message, - byte[] body) { - super(message); - Utils.checkNotNull(rawResponse, "rawResponse"); - Utils.checkNotNull(message, "message"); - Utils.checkNotNull(body, "body"); - this.rawResponse = rawResponse; - this.code = code; - this.message = message; - this.body = body; + int code, + @Nullable byte[] body, + HttpResponse rawResponse, + @Nullable Throwable cause) { + super(message, code, body, rawResponse, cause); } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - APIException other = (APIException) o; - return - java.util.Objects.deepEquals(this.rawResponse, other.rawResponse) && - java.util.Objects.deepEquals(this.code, other.code) && - java.util.Objects.deepEquals(this.message, other.message) && - java.util.Objects.deepEquals(this.body, other.body); + + public static APIException from(String message, HttpResponse rawResponse) { + return from(message, rawResponse, null); } - - @Override - public int hashCode() { - return java.util.Objects.hash( - rawResponse, - code, - message, - body); + + public static APIException from(String message, HttpResponse rawResponse, @Nullable Throwable cause) { + try { + return new APIException( + message, rawResponse.statusCode(), Utils.extractByteArrayFromBody(rawResponse), rawResponse, cause); + } catch (IOException e) { + // Gracefully handle IOExceptions that occur while reading the body + // by returning an error without a body. + return new APIException( + message, rawResponse.statusCode(), null, rawResponse, cause); + } } + @SuppressWarnings("unchecked") @Override - public String toString() { - return Utils.toString(APIException.class, - "requestMethod", rawResponse.request().method(), - "requestUri", rawResponse.request().uri(), - "code", code, - "responseHeaders", rawResponse.headers().map(), - "message", message, - "body", bodyAsString()); - } - public HttpResponse rawResponse() { - return this.rawResponse; - } - - public int code() { - return this.code; - } - - public String message() { - return this.message; - } - - public byte[] body() { - return this.body; - } - - public String bodyAsString() { - return new String(body(), StandardCharsets.UTF_8); + return (HttpResponse) super.rawResponse(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/AsyncAPIException.java b/src/main/java/com/docusign/iam/sdk/models/errors/AsyncAPIException.java new file mode 100644 index 0000000..f1f30e6 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/errors/AsyncAPIException.java @@ -0,0 +1,32 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.errors; + +import jakarta.annotation.Nullable; +import java.net.http.HttpResponse; +import com.docusign.iam.sdk.utils.Blob; + +/** + * Thrown by an async service call when an error response occurs. Contains details about the response. + * This is an unchecked exception suitable for use in CompletableFuture chains. + */ +@SuppressWarnings("serial") +public class AsyncAPIException extends IamClientError { + + public AsyncAPIException( + String message, + int code, + @Nullable byte[] body, + HttpResponse rawResponse, + @Nullable Throwable cause) { + super(message, code, body, rawResponse, cause); + } + + @SuppressWarnings("unchecked") + @Override + public HttpResponse rawResponse() { + return (HttpResponse) super.rawResponse(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/AuthException.java b/src/main/java/com/docusign/iam/sdk/models/errors/AuthException.java index c462599..6e3e59d 100644 --- a/src/main/java/com/docusign/iam/sdk/models/errors/AuthException.java +++ b/src/main/java/com/docusign/iam/sdk/models/errors/AuthException.java @@ -3,30 +3,33 @@ */ package com.docusign.iam.sdk.models.errors; +import java.io.InputStream; +import java.net.http.HttpResponse; import java.util.Optional; /** * An exception associated with Authentication or Authorization. */ @SuppressWarnings("serial") -public class AuthException extends RuntimeException { +public class AuthException extends IamClientError { - private final Optional statusCode; - - private AuthException(Optional statusCode, String message) { - super(message); - this.statusCode = statusCode; + public AuthException(String message, int code, byte[] body, HttpResponse rawResponse) { + super(message, code, body, rawResponse, null); } - public AuthException(int statusCode, String message) { - this(Optional.of(statusCode), message); - } - - public AuthException(String message) { - this(Optional.empty(), message); + /** + * Returns the HTTP status code of the response. + * + * @deprecated Use {@link #code()} instead. + */ + @Deprecated + public Optional statusCode() { + return Optional.of(super.code()); } - public Optional statusCode() { - return statusCode; + @SuppressWarnings("unchecked") + @Override + public HttpResponse rawResponse() { + return (HttpResponse) super.rawResponse(); } } diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/Error.java b/src/main/java/com/docusign/iam/sdk/models/errors/Error.java index d5b24b8..20e7df1 100644 --- a/src/main/java/com/docusign/iam/sdk/models/errors/Error.java +++ b/src/main/java/com/docusign/iam/sdk/models/errors/Error.java @@ -9,250 +9,314 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.annotation.Nullable; +import java.io.InputStream; +import java.lang.Deprecated; import java.lang.Override; -import java.lang.RuntimeException; import java.lang.String; import java.lang.SuppressWarnings; +import java.lang.Throwable; +import java.net.http.HttpResponse; import java.time.OffsetDateTime; import java.util.Optional; -/** - * Error - * - *

Bad Request - The request could not be understood or was missing required parameters. - */ @SuppressWarnings("serial") -public class Error extends RuntimeException { - /** - * A message describing the error. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("error") - private Optional error; +public class Error extends IamClientError { - /** - * HTTP status code for the error. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("code") - private Optional code; + @Nullable + private final Data data; - /** - * The timestamp when the error occurred. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("timestamp") - private Optional timestamp; + @Nullable + private final Throwable deserializationException; - @JsonCreator public Error( - @JsonProperty("error") Optional error, - @JsonProperty("code") Optional code, - @JsonProperty("timestamp") Optional timestamp) { - super("API error occurred"); - Utils.checkNotNull(error, "error"); - Utils.checkNotNull(code, "code"); - Utils.checkNotNull(timestamp, "timestamp"); - this.error = error; - this.code = code; - this.timestamp = timestamp; - } - - public Error() { - this(Optional.empty(), Optional.empty(), Optional.empty()); + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { + super("API error occurred", code, body, rawResponse, null); + this.data = data; + this.deserializationException = deserializationException; } /** - * A message describing the error. - */ - @JsonIgnore - public Optional error() { - return error; + * Parse a response into an instance of Error. If deserialization of the response body fails, + * the resulting Error instance will have a null data() value and a non-null deserializationException(). + */ + public static Error from(HttpResponse response) { + try { + byte[] bytes = Utils.extractByteArrayFromBody(response); + Data data = Utils.mapper().readValue(bytes, Data.class); + return new Error(response.statusCode(), bytes, response, data, null); + } catch (Exception e) { + return new Error(response.statusCode(), null, response, null, e); + } } /** - * HTTP status code for the error. + * A message describing the error. */ - @JsonIgnore - public Optional code() { - return code; + @Deprecated + public Optional error() { + return data().flatMap(Data::error); } /** * The timestamp when the error occurred. */ - @JsonIgnore + @Deprecated public Optional timestamp() { - return timestamp; - } - - public static Builder builder() { - return new Builder(); - } - - - /** - * A message describing the error. - */ - public Error withError(String error) { - Utils.checkNotNull(error, "error"); - this.error = Optional.ofNullable(error); - return this; + return data().flatMap(Data::timestamp); } - - /** - * A message describing the error. - */ - public Error withError(Optional error) { - Utils.checkNotNull(error, "error"); - this.error = error; - return this; + public Optional data() { + return Optional.ofNullable(data); } /** - * HTTP status code for the error. + * Returns the exception if an error occurs while deserializing the response body. */ - public Error withCode(String code) { - Utils.checkNotNull(code, "code"); - this.code = Optional.ofNullable(code); - return this; + public Optional deserializationException() { + return Optional.ofNullable(deserializationException); } - - /** - * HTTP status code for the error. + * Data + * + *

Bad Request - The request could not be understood or was missing required parameters. */ - public Error withCode(Optional code) { - Utils.checkNotNull(code, "code"); - this.code = code; - return this; - } - - /** - * The timestamp when the error occurred. - */ - public Error withTimestamp(OffsetDateTime timestamp) { - Utils.checkNotNull(timestamp, "timestamp"); - this.timestamp = Optional.ofNullable(timestamp); - return this; - } - + public static class Data { + /** + * A message describing the error. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("error") + private Optional error; - /** - * The timestamp when the error occurred. - */ - public Error withTimestamp(Optional timestamp) { - Utils.checkNotNull(timestamp, "timestamp"); - this.timestamp = timestamp; - return this; - } + /** + * HTTP status code for the error. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("code") + private Optional code; - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; + /** + * The timestamp when the error occurred. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("timestamp") + private Optional timestamp; + + @JsonCreator + public Data( + @JsonProperty("error") Optional error, + @JsonProperty("code") Optional code, + @JsonProperty("timestamp") Optional timestamp) { + Utils.checkNotNull(error, "error"); + Utils.checkNotNull(code, "code"); + Utils.checkNotNull(timestamp, "timestamp"); + this.error = error; + this.code = code; + this.timestamp = timestamp; } - if (o == null || getClass() != o.getClass()) { - return false; + + public Data() { + this(Optional.empty(), Optional.empty(), Optional.empty()); } - Error other = (Error) o; - return - Utils.enhancedDeepEquals(this.error, other.error) && - Utils.enhancedDeepEquals(this.code, other.code) && - Utils.enhancedDeepEquals(this.timestamp, other.timestamp); - } - - @Override - public int hashCode() { - return Utils.enhancedHash( - error, code, timestamp); - } - - @Override - public String toString() { - return Utils.toString(Error.class, - "error", error, - "code", code, - "timestamp", timestamp); - } - - @SuppressWarnings("UnusedReturnValue") - public final static class Builder { - private Optional error = Optional.empty(); + /** + * A message describing the error. + */ + @JsonIgnore + public Optional error() { + return error; + } - private Optional code = Optional.empty(); + /** + * HTTP status code for the error. + */ + @JsonIgnore + public Optional code() { + return code; + } - private Optional timestamp = Optional.empty(); + /** + * The timestamp when the error occurred. + */ + @JsonIgnore + public Optional timestamp() { + return timestamp; + } - private Builder() { - // force use of static builder() method + public static Builder builder() { + return new Builder(); } /** * A message describing the error. */ - public Builder error(String error) { + public Data withError(String error) { Utils.checkNotNull(error, "error"); this.error = Optional.ofNullable(error); return this; } + /** * A message describing the error. */ - public Builder error(Optional error) { + public Data withError(Optional error) { Utils.checkNotNull(error, "error"); this.error = error; return this; } - /** * HTTP status code for the error. */ - public Builder code(String code) { + public Data withCode(String code) { Utils.checkNotNull(code, "code"); this.code = Optional.ofNullable(code); return this; } + /** * HTTP status code for the error. */ - public Builder code(Optional code) { + public Data withCode(Optional code) { Utils.checkNotNull(code, "code"); this.code = code; return this; } - /** * The timestamp when the error occurred. */ - public Builder timestamp(OffsetDateTime timestamp) { + public Data withTimestamp(OffsetDateTime timestamp) { Utils.checkNotNull(timestamp, "timestamp"); this.timestamp = Optional.ofNullable(timestamp); return this; } + /** * The timestamp when the error occurred. */ - public Builder timestamp(Optional timestamp) { + public Data withTimestamp(Optional timestamp) { Utils.checkNotNull(timestamp, "timestamp"); this.timestamp = timestamp; return this; } - public Error build() { - - return new Error( + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Data other = (Data) o; + return + Utils.enhancedDeepEquals(this.error, other.error) && + Utils.enhancedDeepEquals(this.code, other.code) && + Utils.enhancedDeepEquals(this.timestamp, other.timestamp); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( error, code, timestamp); } + + @Override + public String toString() { + return Utils.toString(Data.class, + "error", error, + "code", code, + "timestamp", timestamp); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional error = Optional.empty(); + + private Optional code = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * A message describing the error. + */ + public Builder error(String error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * A message describing the error. + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + + /** + * HTTP status code for the error. + */ + public Builder code(String code) { + Utils.checkNotNull(code, "code"); + this.code = Optional.ofNullable(code); + return this; + } + + /** + * HTTP status code for the error. + */ + public Builder code(Optional code) { + Utils.checkNotNull(code, "code"); + this.code = code; + return this; + } + + + /** + * The timestamp when the error occurred. + */ + public Builder timestamp(OffsetDateTime timestamp) { + Utils.checkNotNull(timestamp, "timestamp"); + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + /** + * The timestamp when the error occurred. + */ + public Builder timestamp(Optional timestamp) { + Utils.checkNotNull(timestamp, "timestamp"); + this.timestamp = timestamp; + return this; + } + + public Data build() { + + return new Data( + error, code, timestamp); + } + } } + } diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/ErrorDetails.java b/src/main/java/com/docusign/iam/sdk/models/errors/ErrorDetails.java index e14c694..e715cc7 100644 --- a/src/main/java/com/docusign/iam/sdk/models/errors/ErrorDetails.java +++ b/src/main/java/com/docusign/iam/sdk/models/errors/ErrorDetails.java @@ -9,154 +9,128 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.annotation.Nullable; +import java.io.InputStream; +import java.lang.Deprecated; import java.lang.Override; -import java.lang.RuntimeException; import java.lang.String; import java.lang.SuppressWarnings; +import java.lang.Throwable; +import java.net.http.HttpResponse; +import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; -/** - * ErrorDetails - * - *

The error response object for the Workspaces API - */ @SuppressWarnings("serial") -public class ErrorDetails extends RuntimeException { - /** - * A brief message describing the error condition - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("message") - private JsonNullable message; +public class ErrorDetails extends IamClientError { - /** - * A standardized code that generalizes the specific error - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("error_code") - private JsonNullable errorCode; + @Nullable + private final Data data; + + @Nullable + private final Throwable deserializationException; - @JsonCreator public ErrorDetails( - @JsonProperty("message") JsonNullable message, - @JsonProperty("error_code") JsonNullable errorCode) { - super("API error occurred"); - Utils.checkNotNull(message, "message"); - Utils.checkNotNull(errorCode, "errorCode"); - this.message = message; - this.errorCode = errorCode; - } - - public ErrorDetails() { - this(JsonNullable.undefined(), JsonNullable.undefined()); + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { + super("API error occurred", code, body, rawResponse, null); + this.data = data; + this.deserializationException = deserializationException; } /** - * A brief message describing the error condition - */ - @JsonIgnore - public JsonNullable message() { - return message; - } - - @JsonIgnore - @Override - public String getMessage() { - return Utils.valueOrNull(message); + * Parse a response into an instance of ErrorDetails. If deserialization of the response body fails, + * the resulting ErrorDetails instance will have a null data() value and a non-null deserializationException(). + */ + public static ErrorDetails from(HttpResponse response) { + try { + byte[] bytes = Utils.extractByteArrayFromBody(response); + Data data = Utils.mapper().readValue(bytes, Data.class); + return new ErrorDetails(response.statusCode(), bytes, response, data, null); + } catch (Exception e) { + return new ErrorDetails(response.statusCode(), null, response, null, e); + } } /** * A standardized code that generalizes the specific error */ - @JsonIgnore - public JsonNullable errorCode() { - return errorCode; + @Deprecated + public Optional> errorCode() { + return data().map(Data::errorCode); } - public static Builder builder() { - return new Builder(); + public Optional data() { + return Optional.ofNullable(data); } - /** - * A brief message describing the error condition + * Returns the exception if an error occurs while deserializing the response body. */ - public ErrorDetails withMessage(String message) { - Utils.checkNotNull(message, "message"); - this.message = JsonNullable.of(message); - return this; + public Optional deserializationException() { + return Optional.ofNullable(deserializationException); } - /** - * A brief message describing the error condition + * Data + * + *

The error response object for the Workspaces API */ - public ErrorDetails withMessage(JsonNullable message) { - Utils.checkNotNull(message, "message"); - this.message = message; - return this; - } - - /** - * A standardized code that generalizes the specific error - */ - public ErrorDetails withErrorCode(String errorCode) { - Utils.checkNotNull(errorCode, "errorCode"); - this.errorCode = JsonNullable.of(errorCode); - return this; - } - - /** - * A standardized code that generalizes the specific error - */ - public ErrorDetails withErrorCode(JsonNullable errorCode) { - Utils.checkNotNull(errorCode, "errorCode"); - this.errorCode = errorCode; - return this; - } + public static class Data { + /** + * A brief message describing the error condition + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("message") + private JsonNullable message; - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; + /** + * A standardized code that generalizes the specific error + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("error_code") + private JsonNullable errorCode; + + @JsonCreator + public Data( + @JsonProperty("message") JsonNullable message, + @JsonProperty("error_code") JsonNullable errorCode) { + Utils.checkNotNull(message, "message"); + Utils.checkNotNull(errorCode, "errorCode"); + this.message = message; + this.errorCode = errorCode; } - if (o == null || getClass() != o.getClass()) { - return false; + + public Data() { + this(JsonNullable.undefined(), JsonNullable.undefined()); } - ErrorDetails other = (ErrorDetails) o; - return - Utils.enhancedDeepEquals(this.message, other.message) && - Utils.enhancedDeepEquals(this.errorCode, other.errorCode); - } - - @Override - public int hashCode() { - return Utils.enhancedHash( - message, errorCode); - } - - @Override - public String toString() { - return Utils.toString(ErrorDetails.class, - "message", message, - "errorCode", errorCode); - } - @SuppressWarnings("UnusedReturnValue") - public final static class Builder { - - private JsonNullable message = JsonNullable.undefined(); + /** + * A brief message describing the error condition + */ + @JsonIgnore + public JsonNullable message() { + return message; + } - private JsonNullable errorCode = JsonNullable.undefined(); + /** + * A standardized code that generalizes the specific error + */ + @JsonIgnore + public JsonNullable errorCode() { + return errorCode; + } - private Builder() { - // force use of static builder() method + public static Builder builder() { + return new Builder(); } /** * A brief message describing the error condition */ - public Builder message(String message) { + public Data withMessage(String message) { Utils.checkNotNull(message, "message"); this.message = JsonNullable.of(message); return this; @@ -165,17 +139,16 @@ public Builder message(String message) { /** * A brief message describing the error condition */ - public Builder message(JsonNullable message) { + public Data withMessage(JsonNullable message) { Utils.checkNotNull(message, "message"); this.message = message; return this; } - /** * A standardized code that generalizes the specific error */ - public Builder errorCode(String errorCode) { + public Data withErrorCode(String errorCode) { Utils.checkNotNull(errorCode, "errorCode"); this.errorCode = JsonNullable.of(errorCode); return this; @@ -184,18 +157,96 @@ public Builder errorCode(String errorCode) { /** * A standardized code that generalizes the specific error */ - public Builder errorCode(JsonNullable errorCode) { + public Data withErrorCode(JsonNullable errorCode) { Utils.checkNotNull(errorCode, "errorCode"); this.errorCode = errorCode; return this; } - public ErrorDetails build() { - - return new ErrorDetails( + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Data other = (Data) o; + return + Utils.enhancedDeepEquals(this.message, other.message) && + Utils.enhancedDeepEquals(this.errorCode, other.errorCode); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( message, errorCode); } + + @Override + public String toString() { + return Utils.toString(Data.class, + "message", message, + "errorCode", errorCode); + } + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable message = JsonNullable.undefined(); + + private JsonNullable errorCode = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + /** + * A brief message describing the error condition + */ + public Builder message(String message) { + Utils.checkNotNull(message, "message"); + this.message = JsonNullable.of(message); + return this; + } + + /** + * A brief message describing the error condition + */ + public Builder message(JsonNullable message) { + Utils.checkNotNull(message, "message"); + this.message = message; + return this; + } + + + /** + * A standardized code that generalizes the specific error + */ + public Builder errorCode(String errorCode) { + Utils.checkNotNull(errorCode, "errorCode"); + this.errorCode = JsonNullable.of(errorCode); + return this; + } + + /** + * A standardized code that generalizes the specific error + */ + public Builder errorCode(JsonNullable errorCode) { + Utils.checkNotNull(errorCode, "errorCode"); + this.errorCode = errorCode; + return this; + } + + public Data build() { + + return new Data( + message, errorCode); + } + + } } + } diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/IamClientError.java b/src/main/java/com/docusign/iam/sdk/models/errors/IamClientError.java new file mode 100644 index 0000000..301429e --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/errors/IamClientError.java @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.errors; + +import com.docusign.iam.sdk.utils.Utils; +import com.docusign.iam.sdk.utils.Headers; + +import jakarta.annotation.Nullable; + +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +@SuppressWarnings("serial") +public abstract class IamClientError extends RuntimeException { + + private int code; + private byte[] body; + private HttpResponse rawResponse; + + public IamClientError(String message, int code, @Nullable byte[] body, HttpResponse rawResponse, @Nullable Throwable cause) { + super(message, cause); + Utils.checkNotNull(message, "message"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.body = body; + this.code = code; + this.rawResponse = rawResponse; + } + + public Optional body() { + return Optional.ofNullable(body); + } + + public Optional bodyAsString() { + return body().map(x -> new String(x, StandardCharsets.UTF_8)); + } + + public int code() { + return code; + } + + /** + * Returns the raw HTTP response associated with this exception. The response body stream + * may not be available (but the body can be accessed via the {@code body()} method). + * + * @return the raw HTTP response + */ + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Returns the headers from the raw HTTP response as a map. + * + * @return response headers + */ + public Headers headers() { + return new Headers(rawResponse.headers().map()); + } + + // present for backwards compatibility + public String message() { + return getMessage(); + } + + public IamClientError withCode(int code) { + this.code = code; + return this; + } + + public IamClientError withBody(@Nullable byte[] body) { + Utils.checkNotNull(body, "body"); + this.body = body; + return this; + } + + public IamClientError withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public String toString() { + return Utils.toString(this.getClass(), + "requestMethod", rawResponse.request().method(), + "requestUri", rawResponse.request().uri(), + "code", code, + "responseHeaders", rawResponse.headers().map(), + "message", getMessage(), + "body", bodyAsString().orElse("null")); + } +} + diff --git a/src/main/java/com/docusign/iam/sdk/models/errors/OAuthErrorResponse.java b/src/main/java/com/docusign/iam/sdk/models/errors/OAuthErrorResponse.java index 5b7bcfe..87ee7f6 100644 --- a/src/main/java/com/docusign/iam/sdk/models/errors/OAuthErrorResponse.java +++ b/src/main/java/com/docusign/iam/sdk/models/errors/OAuthErrorResponse.java @@ -9,149 +9,208 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.annotation.Nullable; +import java.io.InputStream; +import java.lang.Deprecated; import java.lang.Override; -import java.lang.RuntimeException; import java.lang.String; import java.lang.SuppressWarnings; +import java.lang.Throwable; +import java.net.http.HttpResponse; +import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; - @SuppressWarnings("serial") -public class OAuthErrorResponse extends RuntimeException { - - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("error") - private JsonNullable error; +public class OAuthErrorResponse extends IamClientError { + @Nullable + private final Data data; - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("error_description") - private JsonNullable errorDescription; + @Nullable + private final Throwable deserializationException; - @JsonCreator public OAuthErrorResponse( - @JsonProperty("error") JsonNullable error, - @JsonProperty("error_description") JsonNullable errorDescription) { - super("API error occurred"); - Utils.checkNotNull(error, "error"); - Utils.checkNotNull(errorDescription, "errorDescription"); - this.error = error; - this.errorDescription = errorDescription; - } - - public OAuthErrorResponse() { - this(JsonNullable.undefined(), JsonNullable.undefined()); + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { + super("API error occurred", code, body, rawResponse, null); + this.data = data; + this.deserializationException = deserializationException; } - @JsonIgnore - public JsonNullable error() { - return error; + /** + * Parse a response into an instance of OAuthErrorResponse. If deserialization of the response body fails, + * the resulting OAuthErrorResponse instance will have a null data() value and a non-null deserializationException(). + */ + public static OAuthErrorResponse from(HttpResponse response) { + try { + byte[] bytes = Utils.extractByteArrayFromBody(response); + Data data = Utils.mapper().readValue(bytes, Data.class); + return new OAuthErrorResponse(response.statusCode(), bytes, response, data, null); + } catch (Exception e) { + return new OAuthErrorResponse(response.statusCode(), null, response, null, e); + } } - @JsonIgnore - public JsonNullable errorDescription() { - return errorDescription; + @Deprecated + public Optional> error() { + return data().map(Data::error); } - public static Builder builder() { - return new Builder(); + @Deprecated + public Optional> errorDescription() { + return data().map(Data::errorDescription); } - - public OAuthErrorResponse withError(String error) { - Utils.checkNotNull(error, "error"); - this.error = JsonNullable.of(error); - return this; + public Optional data() { + return Optional.ofNullable(data); } - public OAuthErrorResponse withError(JsonNullable error) { - Utils.checkNotNull(error, "error"); - this.error = error; - return this; + /** + * Returns the exception if an error occurs while deserializing the response body. + */ + public Optional deserializationException() { + return Optional.ofNullable(deserializationException); } - public OAuthErrorResponse withErrorDescription(String errorDescription) { - Utils.checkNotNull(errorDescription, "errorDescription"); - this.errorDescription = JsonNullable.of(errorDescription); - return this; - } + public static class Data { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("error") + private JsonNullable error; - public OAuthErrorResponse withErrorDescription(JsonNullable errorDescription) { - Utils.checkNotNull(errorDescription, "errorDescription"); - this.errorDescription = errorDescription; - return this; - } - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("error_description") + private JsonNullable errorDescription; + + @JsonCreator + public Data( + @JsonProperty("error") JsonNullable error, + @JsonProperty("error_description") JsonNullable errorDescription) { + Utils.checkNotNull(error, "error"); + Utils.checkNotNull(errorDescription, "errorDescription"); + this.error = error; + this.errorDescription = errorDescription; } - if (o == null || getClass() != o.getClass()) { - return false; + + public Data() { + this(JsonNullable.undefined(), JsonNullable.undefined()); } - OAuthErrorResponse other = (OAuthErrorResponse) o; - return - Utils.enhancedDeepEquals(this.error, other.error) && - Utils.enhancedDeepEquals(this.errorDescription, other.errorDescription); - } - - @Override - public int hashCode() { - return Utils.enhancedHash( - error, errorDescription); - } - - @Override - public String toString() { - return Utils.toString(OAuthErrorResponse.class, - "error", error, - "errorDescription", errorDescription); - } - - @SuppressWarnings("UnusedReturnValue") - public final static class Builder { - private JsonNullable error = JsonNullable.undefined(); + @JsonIgnore + public JsonNullable error() { + return error; + } - private JsonNullable errorDescription = JsonNullable.undefined(); + @JsonIgnore + public JsonNullable errorDescription() { + return errorDescription; + } - private Builder() { - // force use of static builder() method + public static Builder builder() { + return new Builder(); } - public Builder error(String error) { + public Data withError(String error) { Utils.checkNotNull(error, "error"); this.error = JsonNullable.of(error); return this; } - public Builder error(JsonNullable error) { + public Data withError(JsonNullable error) { Utils.checkNotNull(error, "error"); this.error = error; return this; } - - public Builder errorDescription(String errorDescription) { + public Data withErrorDescription(String errorDescription) { Utils.checkNotNull(errorDescription, "errorDescription"); this.errorDescription = JsonNullable.of(errorDescription); return this; } - public Builder errorDescription(JsonNullable errorDescription) { + public Data withErrorDescription(JsonNullable errorDescription) { Utils.checkNotNull(errorDescription, "errorDescription"); this.errorDescription = errorDescription; return this; } - public OAuthErrorResponse build() { - - return new OAuthErrorResponse( + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Data other = (Data) o; + return + Utils.enhancedDeepEquals(this.error, other.error) && + Utils.enhancedDeepEquals(this.errorDescription, other.errorDescription); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( error, errorDescription); } + + @Override + public String toString() { + return Utils.toString(Data.class, + "error", error, + "errorDescription", errorDescription); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private JsonNullable error = JsonNullable.undefined(); + + private JsonNullable errorDescription = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + public Builder error(String error) { + Utils.checkNotNull(error, "error"); + this.error = JsonNullable.of(error); + return this; + } + + public Builder error(JsonNullable error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + + public Builder errorDescription(String errorDescription) { + Utils.checkNotNull(errorDescription, "errorDescription"); + this.errorDescription = JsonNullable.of(errorDescription); + return this; + } + + public Builder errorDescription(JsonNullable errorDescription) { + Utils.checkNotNull(errorDescription, "errorDescription"); + this.errorDescription = errorDescription; + return this; + } + + public Data build() { + + return new Data( + error, errorDescription); + } + + } } + } diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceDocumentRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceDocumentRequestBuilder.java index b068660..4b392f3 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceDocumentRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceDocumentRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -75,7 +74,7 @@ private com.docusign.iam.sdk.models.operations.AddWorkspaceDocumentRequest build return request; } - public AddWorkspaceDocumentResponse call() throws Exception { + public AddWorkspaceDocumentResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUploadRequestDocumentRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUploadRequestDocumentRequestBuilder.java index 74854f7..b000383 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUploadRequestDocumentRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUploadRequestDocumentRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -83,7 +82,7 @@ private com.docusign.iam.sdk.models.operations.AddWorkspaceUploadRequestDocument return request; } - public AddWorkspaceUploadRequestDocumentResponse call() throws Exception { + public AddWorkspaceUploadRequestDocumentResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUserRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUserRequestBuilder.java index 902dd37..e603231 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUserRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/AddWorkspaceUserRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -75,7 +74,7 @@ private AddWorkspaceUserRequest buildRequest() { return request; } - public AddWorkspaceUserResponse call() throws Exception { + public AddWorkspaceUserResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/CancelWorkflowInstanceRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/CancelWorkflowInstanceRequestBuilder.java index 0401437..ee9e3d0 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/CancelWorkflowInstanceRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/CancelWorkflowInstanceRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private CancelWorkflowInstanceRequest buildRequest() { return request; } - public CancelWorkflowInstanceResponse call() throws Exception { + public CancelWorkflowInstanceResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/CompleteWorkspaceUploadRequestRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/CompleteWorkspaceUploadRequestRequestBuilder.java index 824fb00..1a99fcb 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/CompleteWorkspaceUploadRequestRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/CompleteWorkspaceUploadRequestRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private CompleteWorkspaceUploadRequestRequest buildRequest() { return request; } - public CompleteWorkspaceUploadRequestResponse call() throws Exception { + public CompleteWorkspaceUploadRequestResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/ConnectedFieldsApiGetTabGroupsRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/ConnectedFieldsApiGetTabGroupsRequestBuilder.java index cdf4c1a..6ad7276 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/ConnectedFieldsApiGetTabGroupsRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/ConnectedFieldsApiGetTabGroupsRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -66,7 +65,7 @@ private ConnectedFieldsApiGetTabGroupsRequest buildRequest() { return request; } - public ConnectedFieldsApiGetTabGroupsResponse call() throws Exception { + public ConnectedFieldsApiGetTabGroupsResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/CreateAgreementSummaryRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/CreateAgreementSummaryRequestBuilder.java index e4849ca..5d26686 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/CreateAgreementSummaryRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/CreateAgreementSummaryRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private CreateAgreementSummaryRequest buildRequest() { return request; } - public CreateAgreementSummaryResponse call() throws Exception { + public CreateAgreementSummaryResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceEnvelopeRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceEnvelopeRequestBuilder.java index 4669045..b5d8054 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceEnvelopeRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceEnvelopeRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -69,7 +68,7 @@ private CreateWorkspaceEnvelopeRequest buildRequest() { return request; } - public CreateWorkspaceEnvelopeResponse call() throws Exception { + public CreateWorkspaceEnvelopeResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceRequestBuilder.java index d03b88d..9a67d41 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -61,7 +60,7 @@ private CreateWorkspaceRequest buildRequest() { return request; } - public CreateWorkspaceResponse call() throws Exception { + public CreateWorkspaceResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceUploadRequestRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceUploadRequestRequestBuilder.java index 09932b9..783c209 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceUploadRequestRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/CreateWorkspaceUploadRequestRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -69,7 +68,7 @@ private CreateWorkspaceUploadRequestRequest buildRequest() { return request; } - public CreateWorkspaceUploadRequestResponse call() throws Exception { + public CreateWorkspaceUploadRequestResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/DeleteAgreementRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/DeleteAgreementRequestBuilder.java index f911850..8e2a1a1 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/DeleteAgreementRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/DeleteAgreementRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private DeleteAgreementRequest buildRequest() { return request; } - public DeleteAgreementResponse call() throws Exception { + public DeleteAgreementResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceDocumentRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceDocumentRequestBuilder.java index e79f878..34eae4d 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceDocumentRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceDocumentRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private DeleteWorkspaceDocumentRequest buildRequest() { return request; } - public DeleteWorkspaceDocumentResponse call() throws Exception { + public DeleteWorkspaceDocumentResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceUploadRequestRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceUploadRequestRequestBuilder.java index adf833b..253b447 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceUploadRequestRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/DeleteWorkspaceUploadRequestRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private DeleteWorkspaceUploadRequestRequest buildRequest() { return request; } - public DeleteWorkspaceUploadRequestResponse call() throws Exception { + public DeleteWorkspaceUploadRequestResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementRequestBuilder.java index bbdea31..499f113 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private GetAgreementRequest buildRequest() { return request; } - public GetAgreementResponse call() throws Exception { + public GetAgreementResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementsListRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementsListRequestBuilder.java index cb7d9bd..fb7fdb3 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementsListRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetAgreementsListRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.util.Optional; public class GetAgreementsListRequestBuilder { @@ -43,7 +42,7 @@ public GetAgreementsListRequestBuilder retryConfig(Optional retryCo return this; } - public GetAgreementsListResponse call() throws Exception { + public GetAgreementsListResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromConfidentialAuthCodeRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromConfidentialAuthCodeRequestBuilder.java index 36bc6aa..c4b34d1 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromConfidentialAuthCodeRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromConfidentialAuthCodeRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -65,7 +64,7 @@ public GetTokenFromConfidentialAuthCodeRequestBuilder retryConfig(Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromJWTGrantRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromJWTGrantRequestBuilder.java index 382a51d..c901b9c 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromJWTGrantRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromJWTGrantRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -57,7 +56,7 @@ public GetTokenFromJWTGrantRequestBuilder retryConfig(Optional retr return this; } - public GetTokenFromJWTGrantResponse call() throws Exception { + public GetTokenFromJWTGrantResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromPublicAuthCodeRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromPublicAuthCodeRequestBuilder.java index b01a0db..1e0bd95 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromPublicAuthCodeRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromPublicAuthCodeRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -58,7 +57,7 @@ public GetTokenFromPublicAuthCodeRequestBuilder retryConfig(Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromRefreshTokenRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromRefreshTokenRequestBuilder.java index c972a23..c8c2c3c 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromRefreshTokenRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetTokenFromRefreshTokenRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -64,7 +63,7 @@ public GetTokenFromRefreshTokenRequestBuilder retryConfig(Optional return this; } - public GetTokenFromRefreshTokenResponse call() throws Exception { + public GetTokenFromRefreshTokenResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetUserInfoRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetUserInfoRequestBuilder.java index 24b00e0..ce5b295 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetUserInfoRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetUserInfoRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -50,7 +49,7 @@ public GetUserInfoRequestBuilder retryConfig(Optional retryConfig) return this; } - public GetUserInfoResponse call() throws Exception { + public GetUserInfoResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstanceRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstanceRequestBuilder.java index ec99d14..85c5518 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstanceRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstanceRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private GetWorkflowInstanceRequest buildRequest() { return request; } - public GetWorkflowInstanceResponse call() throws Exception { + public GetWorkflowInstanceResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstancesListRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstancesListRequestBuilder.java index bea7bf1..f1c064e 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstancesListRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowInstancesListRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private GetWorkflowInstancesListRequest buildRequest() { return request; } - public GetWorkflowInstancesListResponse call() throws Exception { + public GetWorkflowInstancesListResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowTriggerRequirementsRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowTriggerRequirementsRequestBuilder.java index a04d334..a8e1269 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowTriggerRequirementsRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowTriggerRequirementsRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private GetWorkflowTriggerRequirementsRequest buildRequest() { return request; } - public GetWorkflowTriggerRequirementsResponse call() throws Exception { + public GetWorkflowTriggerRequirementsResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowsListRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowsListRequestBuilder.java index 1237bae..a08a5fe 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowsListRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkflowsListRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -66,7 +65,7 @@ private GetWorkflowsListRequest buildRequest() { return request; } - public GetWorkflowsListResponse call() throws Exception { + public GetWorkflowsListResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceAssignableRolesRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceAssignableRolesRequestBuilder.java index 876757f..e0f56b2 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceAssignableRolesRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceAssignableRolesRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.util.Optional; public class GetWorkspaceAssignableRolesRequestBuilder { @@ -43,7 +42,7 @@ public GetWorkspaceAssignableRolesRequestBuilder retryConfig(Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandRequest.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandRequest.java new file mode 100644 index 0000000..fbf2a80 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandRequest.java @@ -0,0 +1,141 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import com.docusign.iam.sdk.utils.SpeakeasyMetadata; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Override; +import java.lang.String; + + +public class GetWorkspaceBrandRequest { + /** + * The ID of the account + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=accountId") + private String accountId; + + /** + * The ID of the workspace + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=workspaceId") + private String workspaceId; + + @JsonCreator + public GetWorkspaceBrandRequest( + String accountId, + String workspaceId) { + Utils.checkNotNull(accountId, "accountId"); + Utils.checkNotNull(workspaceId, "workspaceId"); + this.accountId = accountId; + this.workspaceId = workspaceId; + } + + /** + * The ID of the account + */ + @JsonIgnore + public String accountId() { + return accountId; + } + + /** + * The ID of the workspace + */ + @JsonIgnore + public String workspaceId() { + return workspaceId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The ID of the account + */ + public GetWorkspaceBrandRequest withAccountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + /** + * The ID of the workspace + */ + public GetWorkspaceBrandRequest withWorkspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWorkspaceBrandRequest other = (GetWorkspaceBrandRequest) o; + return + Utils.enhancedDeepEquals(this.accountId, other.accountId) && + Utils.enhancedDeepEquals(this.workspaceId, other.workspaceId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + accountId, workspaceId); + } + + @Override + public String toString() { + return Utils.toString(GetWorkspaceBrandRequest.class, + "accountId", accountId, + "workspaceId", workspaceId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String accountId; + + private String workspaceId; + + private Builder() { + // force use of static builder() method + } + + + /** + * The ID of the account + */ + public Builder accountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + + /** + * The ID of the workspace + */ + public Builder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + public GetWorkspaceBrandRequest build() { + + return new GetWorkspaceBrandRequest( + accountId, workspaceId); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandRequestBuilder.java new file mode 100644 index 0000000..5eff7cb --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandRequestBuilder.java @@ -0,0 +1,73 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; + +import com.docusign.iam.sdk.SDKConfiguration; +import com.docusign.iam.sdk.operations.GetWorkspaceBrand; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Options; +import com.docusign.iam.sdk.utils.RetryConfig; +import com.docusign.iam.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; + +public class GetWorkspaceBrandRequestBuilder { + + private String accountId; + private String workspaceId; + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetWorkspaceBrandRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetWorkspaceBrandRequestBuilder accountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + public GetWorkspaceBrandRequestBuilder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + public GetWorkspaceBrandRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public GetWorkspaceBrandRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private GetWorkspaceBrandRequest buildRequest() { + + GetWorkspaceBrandRequest request = new GetWorkspaceBrandRequest(accountId, + workspaceId); + + return request; + } + + public GetWorkspaceBrandResponse call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + RequestOperation operation + = new GetWorkspaceBrand.Sync(sdkConfiguration, options, _headers); + GetWorkspaceBrandRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandResponse.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandResponse.java new file mode 100644 index 0000000..f4d4cfc --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceBrandResponse.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import com.docusign.iam.sdk.utils.Response; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 GetWorkspaceBrandResponse 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; + + /** + * Workspace successfully retrieved + */ + private Optional getWorkspaceBrandResponse; + + @JsonCreator + public GetWorkspaceBrandResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional getWorkspaceBrandResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(getWorkspaceBrandResponse, "getWorkspaceBrandResponse"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.getWorkspaceBrandResponse = getWorkspaceBrandResponse; + } + + public GetWorkspaceBrandResponse( + 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; + } + + /** + * Workspace successfully retrieved + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional getWorkspaceBrandResponse() { + return (Optional) getWorkspaceBrandResponse; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetWorkspaceBrandResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetWorkspaceBrandResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetWorkspaceBrandResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Workspace successfully retrieved + */ + public GetWorkspaceBrandResponse withGetWorkspaceBrandResponse(com.docusign.iam.sdk.models.components.GetWorkspaceBrandResponse getWorkspaceBrandResponse) { + Utils.checkNotNull(getWorkspaceBrandResponse, "getWorkspaceBrandResponse"); + this.getWorkspaceBrandResponse = Optional.ofNullable(getWorkspaceBrandResponse); + return this; + } + + + /** + * Workspace successfully retrieved + */ + public GetWorkspaceBrandResponse withGetWorkspaceBrandResponse(Optional getWorkspaceBrandResponse) { + Utils.checkNotNull(getWorkspaceBrandResponse, "getWorkspaceBrandResponse"); + this.getWorkspaceBrandResponse = getWorkspaceBrandResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWorkspaceBrandResponse other = (GetWorkspaceBrandResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.getWorkspaceBrandResponse, other.getWorkspaceBrandResponse); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + getWorkspaceBrandResponse); + } + + @Override + public String toString() { + return Utils.toString(GetWorkspaceBrandResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "getWorkspaceBrandResponse", getWorkspaceBrandResponse); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional getWorkspaceBrandResponse = 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; + } + + + /** + * Workspace successfully retrieved + */ + public Builder getWorkspaceBrandResponse(com.docusign.iam.sdk.models.components.GetWorkspaceBrandResponse getWorkspaceBrandResponse) { + Utils.checkNotNull(getWorkspaceBrandResponse, "getWorkspaceBrandResponse"); + this.getWorkspaceBrandResponse = Optional.ofNullable(getWorkspaceBrandResponse); + return this; + } + + /** + * Workspace successfully retrieved + */ + public Builder getWorkspaceBrandResponse(Optional getWorkspaceBrandResponse) { + Utils.checkNotNull(getWorkspaceBrandResponse, "getWorkspaceBrandResponse"); + this.getWorkspaceBrandResponse = getWorkspaceBrandResponse; + return this; + } + + public GetWorkspaceBrandResponse build() { + + return new GetWorkspaceBrandResponse( + contentType, statusCode, rawResponse, + getWorkspaceBrandResponse); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentContentsRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentContentsRequestBuilder.java index 83c020c..473a1d0 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentContentsRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentContentsRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private GetWorkspaceDocumentContentsRequest buildRequest() { return request; } - public GetWorkspaceDocumentContentsResponse call() throws Exception { + public GetWorkspaceDocumentContentsResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentRequestBuilder.java index b5d9238..2fa5b11 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private GetWorkspaceDocumentRequest buildRequest() { return request; } - public GetWorkspaceDocumentResponse call() throws Exception { + public GetWorkspaceDocumentResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentsRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentsRequestBuilder.java index 0dd65a0..b691dd8 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentsRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceDocumentsRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.util.Optional; public class GetWorkspaceDocumentsRequestBuilder { @@ -43,7 +42,7 @@ public GetWorkspaceDocumentsRequestBuilder retryConfig(Optional ret return this; } - public GetWorkspaceDocumentsResponse call() throws Exception { + public GetWorkspaceDocumentsResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceEnvelopesRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceEnvelopesRequestBuilder.java index 56e1f97..c4aaf85 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceEnvelopesRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceEnvelopesRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private GetWorkspaceEnvelopesRequest buildRequest() { return request; } - public GetWorkspaceEnvelopesResponse call() throws Exception { + public GetWorkspaceEnvelopesResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceRequestBuilder.java index f308a28..5bc4b1e 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private GetWorkspaceRequest buildRequest() { return request; } - public GetWorkspaceResponse call() throws Exception { + public GetWorkspaceResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestRequestBuilder.java index 562ccc8..c9e02a7 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private GetWorkspaceUploadRequestRequest buildRequest() { return request; } - public GetWorkspaceUploadRequestResponse call() throws Exception { + public GetWorkspaceUploadRequestResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestsRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestsRequestBuilder.java index 4421185..16e3f95 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestsRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUploadRequestsRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private GetWorkspaceUploadRequestsRequest buildRequest() { return request; } - public GetWorkspaceUploadRequestsResponse call() throws Exception { + public GetWorkspaceUploadRequestsResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUsersRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUsersRequestBuilder.java index 1ac787f..861c2e8 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUsersRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspaceUsersRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.util.Optional; public class GetWorkspaceUsersRequestBuilder { @@ -43,7 +42,7 @@ public GetWorkspaceUsersRequestBuilder retryConfig(Optional retryCo return this; } - public GetWorkspaceUsersResponse call() throws Exception { + public GetWorkspaceUsersResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspacesRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspacesRequestBuilder.java index 907bbe8..7273c0e 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspacesRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/GetWorkspacesRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.Integer; import java.lang.String; import java.util.Optional; @@ -81,7 +80,7 @@ private GetWorkspacesRequest buildRequest() { return request; } - public GetWorkspacesResponse call() throws Exception { + public GetWorkspacesResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/PauseNewWorkflowInstancesRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/PauseNewWorkflowInstancesRequestBuilder.java index e6408f2..67f3561 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/PauseNewWorkflowInstancesRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/PauseNewWorkflowInstancesRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private PauseNewWorkflowInstancesRequest buildRequest() { return request; } - public PauseNewWorkflowInstancesResponse call() throws Exception { + public PauseNewWorkflowInstancesResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/RestoreWorkspaceUserAccessRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/RestoreWorkspaceUserAccessRequestBuilder.java index 181883b..5c25893 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/RestoreWorkspaceUserAccessRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/RestoreWorkspaceUserAccessRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private RestoreWorkspaceUserAccessRequest buildRequest() { return request; } - public RestoreWorkspaceUserAccessResponse call() throws Exception { + public RestoreWorkspaceUserAccessResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/ResumePausedWorkflowRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/ResumePausedWorkflowRequestBuilder.java index dfb6747..058586f 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/ResumePausedWorkflowRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/ResumePausedWorkflowRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -60,7 +59,7 @@ private ResumePausedWorkflowRequest buildRequest() { return request; } - public ResumePausedWorkflowResponse call() throws Exception { + public ResumePausedWorkflowResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/RevokeWorkspaceUserAccessRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/RevokeWorkspaceUserAccessRequestBuilder.java index f21bba8..61bfb51 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/RevokeWorkspaceUserAccessRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/RevokeWorkspaceUserAccessRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -83,7 +82,7 @@ private RevokeWorkspaceUserAccessRequest buildRequest() { return request; } - public RevokeWorkspaceUserAccessResponse call() throws Exception { + public RevokeWorkspaceUserAccessResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/TriggerWorkflowRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/TriggerWorkflowRequestBuilder.java index 3f482ea..7bee2a6 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/TriggerWorkflowRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/TriggerWorkflowRequestBuilder.java @@ -11,7 +11,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -68,7 +67,7 @@ private TriggerWorkflowRequest buildRequest() { return request; } - public TriggerWorkflowResponse call() throws Exception { + public TriggerWorkflowResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandRequest.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandRequest.java new file mode 100644 index 0000000..4f136dd --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandRequest.java @@ -0,0 +1,171 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBrandBody; +import com.docusign.iam.sdk.utils.SpeakeasyMetadata; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Override; +import java.lang.String; + + +public class UpdateWorkspaceBrandRequest { + /** + * The ID of the account + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=accountId") + private String accountId; + + /** + * The ID of the workspace + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=workspaceId") + private String workspaceId; + + + @SpeakeasyMetadata("request:mediaType=application/json") + private UpdateWorkspaceBrandBody updateWorkspaceBrandBody; + + @JsonCreator + public UpdateWorkspaceBrandRequest( + String accountId, + String workspaceId, + UpdateWorkspaceBrandBody updateWorkspaceBrandBody) { + Utils.checkNotNull(accountId, "accountId"); + Utils.checkNotNull(workspaceId, "workspaceId"); + Utils.checkNotNull(updateWorkspaceBrandBody, "updateWorkspaceBrandBody"); + this.accountId = accountId; + this.workspaceId = workspaceId; + this.updateWorkspaceBrandBody = updateWorkspaceBrandBody; + } + + /** + * The ID of the account + */ + @JsonIgnore + public String accountId() { + return accountId; + } + + /** + * The ID of the workspace + */ + @JsonIgnore + public String workspaceId() { + return workspaceId; + } + + @JsonIgnore + public UpdateWorkspaceBrandBody updateWorkspaceBrandBody() { + return updateWorkspaceBrandBody; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The ID of the account + */ + public UpdateWorkspaceBrandRequest withAccountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + /** + * The ID of the workspace + */ + public UpdateWorkspaceBrandRequest withWorkspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + public UpdateWorkspaceBrandRequest withUpdateWorkspaceBrandBody(UpdateWorkspaceBrandBody updateWorkspaceBrandBody) { + Utils.checkNotNull(updateWorkspaceBrandBody, "updateWorkspaceBrandBody"); + this.updateWorkspaceBrandBody = updateWorkspaceBrandBody; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceBrandRequest other = (UpdateWorkspaceBrandRequest) o; + return + Utils.enhancedDeepEquals(this.accountId, other.accountId) && + Utils.enhancedDeepEquals(this.workspaceId, other.workspaceId) && + Utils.enhancedDeepEquals(this.updateWorkspaceBrandBody, other.updateWorkspaceBrandBody); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + accountId, workspaceId, updateWorkspaceBrandBody); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceBrandRequest.class, + "accountId", accountId, + "workspaceId", workspaceId, + "updateWorkspaceBrandBody", updateWorkspaceBrandBody); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String accountId; + + private String workspaceId; + + private UpdateWorkspaceBrandBody updateWorkspaceBrandBody; + + private Builder() { + // force use of static builder() method + } + + + /** + * The ID of the account + */ + public Builder accountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + + /** + * The ID of the workspace + */ + public Builder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + + public Builder updateWorkspaceBrandBody(UpdateWorkspaceBrandBody updateWorkspaceBrandBody) { + Utils.checkNotNull(updateWorkspaceBrandBody, "updateWorkspaceBrandBody"); + this.updateWorkspaceBrandBody = updateWorkspaceBrandBody; + return this; + } + + public UpdateWorkspaceBrandRequest build() { + + return new UpdateWorkspaceBrandRequest( + accountId, workspaceId, updateWorkspaceBrandBody); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandRequestBuilder.java new file mode 100644 index 0000000..7e69962 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandRequestBuilder.java @@ -0,0 +1,82 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; + +import com.docusign.iam.sdk.SDKConfiguration; +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBrandBody; +import com.docusign.iam.sdk.operations.UpdateWorkspaceBrand; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Options; +import com.docusign.iam.sdk.utils.RetryConfig; +import com.docusign.iam.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; + +public class UpdateWorkspaceBrandRequestBuilder { + + private String accountId; + private String workspaceId; + private UpdateWorkspaceBrandBody updateWorkspaceBrandBody; + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateWorkspaceBrandRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateWorkspaceBrandRequestBuilder accountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + public UpdateWorkspaceBrandRequestBuilder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + public UpdateWorkspaceBrandRequestBuilder updateWorkspaceBrandBody(UpdateWorkspaceBrandBody updateWorkspaceBrandBody) { + Utils.checkNotNull(updateWorkspaceBrandBody, "updateWorkspaceBrandBody"); + this.updateWorkspaceBrandBody = updateWorkspaceBrandBody; + return this; + } + + public UpdateWorkspaceBrandRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public UpdateWorkspaceBrandRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private UpdateWorkspaceBrandRequest buildRequest() { + + UpdateWorkspaceBrandRequest request = new UpdateWorkspaceBrandRequest(accountId, + workspaceId, + updateWorkspaceBrandBody); + + return request; + } + + public UpdateWorkspaceBrandResponse call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + RequestOperation operation + = new UpdateWorkspaceBrand.Sync(sdkConfiguration, options, _headers); + UpdateWorkspaceBrandRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandResponse.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandResponse.java new file mode 100644 index 0000000..de44452 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceBrandResponse.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import com.docusign.iam.sdk.utils.Response; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 UpdateWorkspaceBrandResponse 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; + + /** + * Workspace brand successfully updated + */ + private Optional updateWorkspaceBrandResponse; + + @JsonCreator + public UpdateWorkspaceBrandResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional updateWorkspaceBrandResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(updateWorkspaceBrandResponse, "updateWorkspaceBrandResponse"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.updateWorkspaceBrandResponse = updateWorkspaceBrandResponse; + } + + public UpdateWorkspaceBrandResponse( + 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; + } + + /** + * Workspace brand successfully updated + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional updateWorkspaceBrandResponse() { + return (Optional) updateWorkspaceBrandResponse; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateWorkspaceBrandResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateWorkspaceBrandResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateWorkspaceBrandResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Workspace brand successfully updated + */ + public UpdateWorkspaceBrandResponse withUpdateWorkspaceBrandResponse(com.docusign.iam.sdk.models.components.UpdateWorkspaceBrandResponse updateWorkspaceBrandResponse) { + Utils.checkNotNull(updateWorkspaceBrandResponse, "updateWorkspaceBrandResponse"); + this.updateWorkspaceBrandResponse = Optional.ofNullable(updateWorkspaceBrandResponse); + return this; + } + + + /** + * Workspace brand successfully updated + */ + public UpdateWorkspaceBrandResponse withUpdateWorkspaceBrandResponse(Optional updateWorkspaceBrandResponse) { + Utils.checkNotNull(updateWorkspaceBrandResponse, "updateWorkspaceBrandResponse"); + this.updateWorkspaceBrandResponse = updateWorkspaceBrandResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceBrandResponse other = (UpdateWorkspaceBrandResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.updateWorkspaceBrandResponse, other.updateWorkspaceBrandResponse); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + updateWorkspaceBrandResponse); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceBrandResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "updateWorkspaceBrandResponse", updateWorkspaceBrandResponse); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional updateWorkspaceBrandResponse = 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; + } + + + /** + * Workspace brand successfully updated + */ + public Builder updateWorkspaceBrandResponse(com.docusign.iam.sdk.models.components.UpdateWorkspaceBrandResponse updateWorkspaceBrandResponse) { + Utils.checkNotNull(updateWorkspaceBrandResponse, "updateWorkspaceBrandResponse"); + this.updateWorkspaceBrandResponse = Optional.ofNullable(updateWorkspaceBrandResponse); + return this; + } + + /** + * Workspace brand successfully updated + */ + public Builder updateWorkspaceBrandResponse(Optional updateWorkspaceBrandResponse) { + Utils.checkNotNull(updateWorkspaceBrandResponse, "updateWorkspaceBrandResponse"); + this.updateWorkspaceBrandResponse = updateWorkspaceBrandResponse; + return this; + } + + public UpdateWorkspaceBrandResponse build() { + + return new UpdateWorkspaceBrandResponse( + contentType, statusCode, rawResponse, + updateWorkspaceBrandResponse); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceRequest.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceRequest.java new file mode 100644 index 0000000..eb2dada --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceRequest.java @@ -0,0 +1,171 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBody; +import com.docusign.iam.sdk.utils.SpeakeasyMetadata; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Override; +import java.lang.String; + + +public class UpdateWorkspaceRequest { + /** + * The ID of the account + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=accountId") + private String accountId; + + /** + * The ID of the workspace + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=workspaceId") + private String workspaceId; + + + @SpeakeasyMetadata("request:mediaType=application/json") + private UpdateWorkspaceBody updateWorkspaceBody; + + @JsonCreator + public UpdateWorkspaceRequest( + String accountId, + String workspaceId, + UpdateWorkspaceBody updateWorkspaceBody) { + Utils.checkNotNull(accountId, "accountId"); + Utils.checkNotNull(workspaceId, "workspaceId"); + Utils.checkNotNull(updateWorkspaceBody, "updateWorkspaceBody"); + this.accountId = accountId; + this.workspaceId = workspaceId; + this.updateWorkspaceBody = updateWorkspaceBody; + } + + /** + * The ID of the account + */ + @JsonIgnore + public String accountId() { + return accountId; + } + + /** + * The ID of the workspace + */ + @JsonIgnore + public String workspaceId() { + return workspaceId; + } + + @JsonIgnore + public UpdateWorkspaceBody updateWorkspaceBody() { + return updateWorkspaceBody; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The ID of the account + */ + public UpdateWorkspaceRequest withAccountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + /** + * The ID of the workspace + */ + public UpdateWorkspaceRequest withWorkspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + public UpdateWorkspaceRequest withUpdateWorkspaceBody(UpdateWorkspaceBody updateWorkspaceBody) { + Utils.checkNotNull(updateWorkspaceBody, "updateWorkspaceBody"); + this.updateWorkspaceBody = updateWorkspaceBody; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceRequest other = (UpdateWorkspaceRequest) o; + return + Utils.enhancedDeepEquals(this.accountId, other.accountId) && + Utils.enhancedDeepEquals(this.workspaceId, other.workspaceId) && + Utils.enhancedDeepEquals(this.updateWorkspaceBody, other.updateWorkspaceBody); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + accountId, workspaceId, updateWorkspaceBody); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceRequest.class, + "accountId", accountId, + "workspaceId", workspaceId, + "updateWorkspaceBody", updateWorkspaceBody); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String accountId; + + private String workspaceId; + + private UpdateWorkspaceBody updateWorkspaceBody; + + private Builder() { + // force use of static builder() method + } + + + /** + * The ID of the account + */ + public Builder accountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + + /** + * The ID of the workspace + */ + public Builder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + + public Builder updateWorkspaceBody(UpdateWorkspaceBody updateWorkspaceBody) { + Utils.checkNotNull(updateWorkspaceBody, "updateWorkspaceBody"); + this.updateWorkspaceBody = updateWorkspaceBody; + return this; + } + + public UpdateWorkspaceRequest build() { + + return new UpdateWorkspaceRequest( + accountId, workspaceId, updateWorkspaceBody); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceRequestBuilder.java new file mode 100644 index 0000000..0e4d4a5 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceRequestBuilder.java @@ -0,0 +1,82 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; + +import com.docusign.iam.sdk.SDKConfiguration; +import com.docusign.iam.sdk.models.components.UpdateWorkspaceBody; +import com.docusign.iam.sdk.operations.UpdateWorkspace; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Options; +import com.docusign.iam.sdk.utils.RetryConfig; +import com.docusign.iam.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; + +public class UpdateWorkspaceRequestBuilder { + + private String accountId; + private String workspaceId; + private UpdateWorkspaceBody updateWorkspaceBody; + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateWorkspaceRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateWorkspaceRequestBuilder accountId(String accountId) { + Utils.checkNotNull(accountId, "accountId"); + this.accountId = accountId; + return this; + } + + public UpdateWorkspaceRequestBuilder workspaceId(String workspaceId) { + Utils.checkNotNull(workspaceId, "workspaceId"); + this.workspaceId = workspaceId; + return this; + } + + public UpdateWorkspaceRequestBuilder updateWorkspaceBody(UpdateWorkspaceBody updateWorkspaceBody) { + Utils.checkNotNull(updateWorkspaceBody, "updateWorkspaceBody"); + this.updateWorkspaceBody = updateWorkspaceBody; + return this; + } + + public UpdateWorkspaceRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public UpdateWorkspaceRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private UpdateWorkspaceRequest buildRequest() { + + UpdateWorkspaceRequest request = new UpdateWorkspaceRequest(accountId, + workspaceId, + updateWorkspaceBody); + + return request; + } + + public UpdateWorkspaceResponse call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + RequestOperation operation + = new UpdateWorkspace.Sync(sdkConfiguration, options, _headers); + UpdateWorkspaceRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceResponse.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceResponse.java new file mode 100644 index 0000000..daf101a --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceResponse.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.models.operations; + +import com.docusign.iam.sdk.utils.Response; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 UpdateWorkspaceResponse 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; + + /** + * Workspace successfully updated + */ + private Optional updateWorkspaceResponse; + + @JsonCreator + public UpdateWorkspaceResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional updateWorkspaceResponse) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(updateWorkspaceResponse, "updateWorkspaceResponse"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.updateWorkspaceResponse = updateWorkspaceResponse; + } + + public UpdateWorkspaceResponse( + 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; + } + + /** + * Workspace successfully updated + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional updateWorkspaceResponse() { + return (Optional) updateWorkspaceResponse; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateWorkspaceResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateWorkspaceResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateWorkspaceResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Workspace successfully updated + */ + public UpdateWorkspaceResponse withUpdateWorkspaceResponse(com.docusign.iam.sdk.models.components.UpdateWorkspaceResponse updateWorkspaceResponse) { + Utils.checkNotNull(updateWorkspaceResponse, "updateWorkspaceResponse"); + this.updateWorkspaceResponse = Optional.ofNullable(updateWorkspaceResponse); + return this; + } + + + /** + * Workspace successfully updated + */ + public UpdateWorkspaceResponse withUpdateWorkspaceResponse(Optional updateWorkspaceResponse) { + Utils.checkNotNull(updateWorkspaceResponse, "updateWorkspaceResponse"); + this.updateWorkspaceResponse = updateWorkspaceResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkspaceResponse other = (UpdateWorkspaceResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.updateWorkspaceResponse, other.updateWorkspaceResponse); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + updateWorkspaceResponse); + } + + @Override + public String toString() { + return Utils.toString(UpdateWorkspaceResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "updateWorkspaceResponse", updateWorkspaceResponse); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional updateWorkspaceResponse = 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; + } + + + /** + * Workspace successfully updated + */ + public Builder updateWorkspaceResponse(com.docusign.iam.sdk.models.components.UpdateWorkspaceResponse updateWorkspaceResponse) { + Utils.checkNotNull(updateWorkspaceResponse, "updateWorkspaceResponse"); + this.updateWorkspaceResponse = Optional.ofNullable(updateWorkspaceResponse); + return this; + } + + /** + * Workspace successfully updated + */ + public Builder updateWorkspaceResponse(Optional updateWorkspaceResponse) { + Utils.checkNotNull(updateWorkspaceResponse, "updateWorkspaceResponse"); + this.updateWorkspaceResponse = updateWorkspaceResponse; + return this; + } + + public UpdateWorkspaceResponse build() { + + return new UpdateWorkspaceResponse( + contentType, statusCode, rawResponse, + updateWorkspaceResponse); + } + + } +} diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUploadRequestRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUploadRequestRequestBuilder.java index d4eda60..f0ee86a 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUploadRequestRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUploadRequestRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -77,7 +76,7 @@ private UpdateWorkspaceUploadRequestRequest buildRequest() { return request; } - public UpdateWorkspaceUploadRequestResponse call() throws Exception { + public UpdateWorkspaceUploadRequestResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUserRequestBuilder.java b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUserRequestBuilder.java index c8efecf..b457dad 100644 --- a/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUserRequestBuilder.java +++ b/src/main/java/com/docusign/iam/sdk/models/operations/UpdateWorkspaceUserRequestBuilder.java @@ -12,7 +12,6 @@ import com.docusign.iam.sdk.utils.Options; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import java.lang.Exception; import java.lang.String; import java.util.Optional; @@ -83,7 +82,7 @@ private UpdateWorkspaceUserRequest buildRequest() { return request; } - public UpdateWorkspaceUserResponse call() throws Exception { + public UpdateWorkspaceUserResponse call() { Optional options = Optional.of(Options.builder() .retryConfig(retryConfig) .build()); diff --git a/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceDocument.java b/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceDocument.java index 52e9762..1bf0965 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceDocument.java +++ b/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceDocument.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -156,7 +157,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(AddWorkspaceDocumentRequest request) throws Exception { + public HttpResponse doRequest(AddWorkspaceDocumentRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -178,12 +179,12 @@ public HttpResponse doRequest(AddWorkspaceDocumentRequest request) .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public AddWorkspaceDocumentResponse handleResponse(HttpResponse response) throws Exception { + public AddWorkspaceDocumentResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -199,76 +200,34 @@ public AddWorkspaceDocumentResponse handleResponse(HttpResponse res if (Utils.statusCodeMatches(response.statusCode(), "201")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - CreateWorkspaceDocumentResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateWorkspaceDocumentResponse(out); - return res; + return res.withCreateWorkspaceDocumentResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUploadRequestDocument.java b/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUploadRequestDocument.java index 8aec147..d8b2d5e 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUploadRequestDocument.java +++ b/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUploadRequestDocument.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -155,7 +156,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(AddWorkspaceUploadRequestDocumentRequest request) throws Exception { + public HttpResponse doRequest(AddWorkspaceUploadRequestDocumentRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -177,12 +178,12 @@ public HttpResponse doRequest(AddWorkspaceUploadRequestDocumentRequ .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public AddWorkspaceUploadRequestDocumentResponse handleResponse(HttpResponse response) throws Exception { + public AddWorkspaceUploadRequestDocumentResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -198,76 +199,34 @@ public AddWorkspaceUploadRequestDocumentResponse handleResponse(HttpResponse() { - }); - res.withAddWorkspaceUploadRequestDocumentResponse(out); - return res; + return res.withAddWorkspaceUploadRequestDocumentResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUser.java b/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUser.java index b6b72a4..75c8f06 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUser.java +++ b/src/main/java/com/docusign/iam/sdk/operations/AddWorkspaceUser.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -156,7 +157,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(AddWorkspaceUserRequest request) throws Exception { + public HttpResponse doRequest(AddWorkspaceUserRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -178,12 +179,12 @@ public HttpResponse doRequest(AddWorkspaceUserRequest request) thro .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public AddWorkspaceUserResponse handleResponse(HttpResponse response) throws Exception { + public AddWorkspaceUserResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -199,76 +200,34 @@ public AddWorkspaceUserResponse handleResponse(HttpResponse respons if (Utils.statusCodeMatches(response.statusCode(), "201")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - CreateWorkspaceUserResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateWorkspaceUserResponse(out); - return res; + return res.withCreateWorkspaceUserResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/CancelWorkflowInstance.java b/src/main/java/com/docusign/iam/sdk/operations/CancelWorkflowInstance.java index ee9df93..b929d12 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/CancelWorkflowInstance.java +++ b/src/main/java/com/docusign/iam/sdk/operations/CancelWorkflowInstance.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(CancelWorkflowInstanceRequest request) throws Exception { + public HttpResponse doRequest(CancelWorkflowInstanceRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(CancelWorkflowInstanceRequest request .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public CancelWorkflowInstanceResponse handleResponse(HttpResponse response) throws Exception { + public CancelWorkflowInstanceResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,76 +186,34 @@ public CancelWorkflowInstanceResponse handleResponse(HttpResponse r if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.CancelWorkflowInstanceResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCancelWorkflowInstanceResponse(out); - return res; + return res.withCancelWorkflowInstanceResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/CompleteWorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/operations/CompleteWorkspaceUploadRequest.java index 1571860..c4426e6 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/CompleteWorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/operations/CompleteWorkspaceUploadRequest.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -23,7 +24,6 @@ import com.docusign.iam.sdk.utils.Retries; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; import java.lang.String; @@ -142,7 +142,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(CompleteWorkspaceUploadRequestRequest request) throws Exception { + public HttpResponse doRequest(CompleteWorkspaceUploadRequestRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +164,12 @@ public HttpResponse doRequest(CompleteWorkspaceUploadRequestRequest .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public CompleteWorkspaceUploadRequestResponse handleResponse(HttpResponse response) throws Exception { + public CompleteWorkspaceUploadRequestResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -187,62 +187,29 @@ public CompleteWorkspaceUploadRequestResponse handleResponse(HttpResponse() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/ConnectedFieldsApiGetTabGroups.java b/src/main/java/com/docusign/iam/sdk/operations/ConnectedFieldsApiGetTabGroups.java index 8f05577..9e34855 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/ConnectedFieldsApiGetTabGroups.java +++ b/src/main/java/com/docusign/iam/sdk/operations/ConnectedFieldsApiGetTabGroups.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -147,7 +148,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(ConnectedFieldsApiGetTabGroupsRequest request) throws Exception { + public HttpResponse doRequest(ConnectedFieldsApiGetTabGroupsRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -169,12 +170,12 @@ public HttpResponse doRequest(ConnectedFieldsApiGetTabGroupsRequest .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public ConnectedFieldsApiGetTabGroupsResponse handleResponse(HttpResponse response) throws Exception { + public ConnectedFieldsApiGetTabGroupsResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -190,44 +191,20 @@ public ConnectedFieldsApiGetTabGroupsResponse handleResponse(HttpResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withTabInfos(out); - return res; + return res.withTabInfos(Utils.unmarshal(response, new TypeReference>() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/CreateAgreementSummary.java b/src/main/java/com/docusign/iam/sdk/operations/CreateAgreementSummary.java index 13d349f..0630eb6 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/CreateAgreementSummary.java +++ b/src/main/java/com/docusign/iam/sdk/operations/CreateAgreementSummary.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -143,7 +144,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(CreateAgreementSummaryRequest request) throws Exception { + public HttpResponse doRequest(CreateAgreementSummaryRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -165,12 +166,12 @@ public HttpResponse doRequest(CreateAgreementSummaryRequest request .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public CreateAgreementSummaryResponse handleResponse(HttpResponse response) throws Exception { + public CreateAgreementSummaryResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -186,76 +187,34 @@ public CreateAgreementSummaryResponse handleResponse(HttpResponse r if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - AgreementSummary out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAgreementSummary(out); - return res; + return res.withAgreementSummary(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspace.java b/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspace.java index 1d31159..637a7cc 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspace.java +++ b/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspace.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -28,6 +29,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -119,7 +121,7 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR "json", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -158,7 +160,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(CreateWorkspaceRequest request) throws Exception { + public HttpResponse doRequest(CreateWorkspaceRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -180,12 +182,12 @@ public HttpResponse doRequest(CreateWorkspaceRequest request) throw .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public CreateWorkspaceResponse handleResponse(HttpResponse response) throws Exception { + public CreateWorkspaceResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -201,76 +203,34 @@ public CreateWorkspaceResponse handleResponse(HttpResponse response if (Utils.statusCodeMatches(response.statusCode(), "201")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.CreateWorkspaceResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateWorkspaceResponse(out); - return res; + return res.withCreateWorkspaceResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceEnvelope.java b/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceEnvelope.java index 5a11a2e..58f6394 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceEnvelope.java +++ b/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceEnvelope.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -28,6 +29,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -119,7 +121,7 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR "json", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -158,7 +160,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(CreateWorkspaceEnvelopeRequest request) throws Exception { + public HttpResponse doRequest(CreateWorkspaceEnvelopeRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -180,12 +182,12 @@ public HttpResponse doRequest(CreateWorkspaceEnvelopeRequest reques .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public CreateWorkspaceEnvelopeResponse handleResponse(HttpResponse response) throws Exception { + public CreateWorkspaceEnvelopeResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -201,76 +203,34 @@ public CreateWorkspaceEnvelopeResponse handleResponse(HttpResponse if (Utils.statusCodeMatches(response.statusCode(), "201")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.CreateWorkspaceEnvelopeResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withCreateWorkspaceEnvelopeResponse(out); - return res; + return res.withCreateWorkspaceEnvelopeResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceUploadRequest.java index 5e5b4b5..9aacb84 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/operations/CreateWorkspaceUploadRequest.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -29,6 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -120,7 +122,7 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR "json", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -159,7 +161,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(CreateWorkspaceUploadRequestRequest request) throws Exception { + public HttpResponse doRequest(CreateWorkspaceUploadRequestRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -181,12 +183,12 @@ public HttpResponse doRequest(CreateWorkspaceUploadRequestRequest r .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public CreateWorkspaceUploadRequestResponse handleResponse(HttpResponse response) throws Exception { + public CreateWorkspaceUploadRequestResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -202,76 +204,34 @@ public CreateWorkspaceUploadRequestResponse handleResponse(HttpResponse() { - }); - res.withGetWorkspaceUploadRequestResponse(out); - return res; + return res.withGetWorkspaceUploadRequestResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/DeleteAgreement.java b/src/main/java/com/docusign/iam/sdk/operations/DeleteAgreement.java index cc5d06b..41a2fd5 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/DeleteAgreement.java +++ b/src/main/java/com/docusign/iam/sdk/operations/DeleteAgreement.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -23,7 +24,6 @@ import com.docusign.iam.sdk.utils.Retries; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; import java.lang.String; @@ -142,7 +142,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(DeleteAgreementRequest request) throws Exception { + public HttpResponse doRequest(DeleteAgreementRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +164,12 @@ public HttpResponse doRequest(DeleteAgreementRequest request) throw .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public DeleteAgreementResponse handleResponse(HttpResponse response) throws Exception { + public DeleteAgreementResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -187,62 +187,29 @@ public DeleteAgreementResponse handleResponse(HttpResponse response // no content return res; } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceDocument.java b/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceDocument.java index 3f3cffe..1efaca5 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceDocument.java +++ b/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceDocument.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -23,7 +24,6 @@ import com.docusign.iam.sdk.utils.Retries; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; import java.lang.String; @@ -142,7 +142,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(DeleteWorkspaceDocumentRequest request) throws Exception { + public HttpResponse doRequest(DeleteWorkspaceDocumentRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +164,12 @@ public HttpResponse doRequest(DeleteWorkspaceDocumentRequest reques .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public DeleteWorkspaceDocumentResponse handleResponse(HttpResponse response) throws Exception { + public DeleteWorkspaceDocumentResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -187,62 +187,29 @@ public DeleteWorkspaceDocumentResponse handleResponse(HttpResponse // no content return res; } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceUploadRequest.java index a90cb99..9be6159 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/operations/DeleteWorkspaceUploadRequest.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -23,7 +24,6 @@ import com.docusign.iam.sdk.utils.Retries; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; import java.lang.String; @@ -142,7 +142,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(DeleteWorkspaceUploadRequestRequest request) throws Exception { + public HttpResponse doRequest(DeleteWorkspaceUploadRequestRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +164,12 @@ public HttpResponse doRequest(DeleteWorkspaceUploadRequestRequest r .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public DeleteWorkspaceUploadRequestResponse handleResponse(HttpResponse response) throws Exception { + public DeleteWorkspaceUploadRequestResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -187,62 +187,29 @@ public DeleteWorkspaceUploadRequestResponse handleResponse(HttpResponse() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetAgreement.java b/src/main/java/com/docusign/iam/sdk/operations/GetAgreement.java index de5d143..99a0129 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetAgreement.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetAgreement.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -143,7 +144,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetAgreementRequest request) throws Exception { + public HttpResponse doRequest(GetAgreementRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -165,12 +166,12 @@ public HttpResponse doRequest(GetAgreementRequest request) throws E .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetAgreementResponse handleResponse(HttpResponse response) throws Exception { + public GetAgreementResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -186,76 +187,34 @@ public GetAgreementResponse handleResponse(HttpResponse response) t if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Agreement out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAgreement(out); - return res; + return res.withAgreement(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetAgreementsList.java b/src/main/java/com/docusign/iam/sdk/operations/GetAgreementsList.java index 1c22b0c..04f2719 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetAgreementsList.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetAgreementsList.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -148,7 +149,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetAgreementsListRequest request) throws Exception { + public HttpResponse doRequest(GetAgreementsListRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -170,12 +171,12 @@ public HttpResponse doRequest(GetAgreementsListRequest request) thr .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetAgreementsListResponse handleResponse(HttpResponse response) throws Exception { + public GetAgreementsListResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -191,76 +192,34 @@ public GetAgreementsListResponse handleResponse(HttpResponse respon if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - AgreementsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withAgreementsResponse(out); - return res; + return res.withAgreementsResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromConfidentialAuthCode.java b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromConfidentialAuthCode.java index 5b43b30..6606d73 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromConfidentialAuthCode.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromConfidentialAuthCode.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -30,6 +31,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -142,7 +144,7 @@ HttpRequest buildRequest(T request, TypeReference typeReference) throws "form", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -183,7 +185,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(ConfidentialAuthCodeGrantRequestBody request) throws Exception { + public HttpResponse doRequest(ConfidentialAuthCodeGrantRequestBody request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -205,12 +207,12 @@ public HttpResponse doRequest(ConfidentialAuthCodeGrantRequestBody .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetTokenFromConfidentialAuthCodeResponse handleResponse(HttpResponse response) throws Exception { + public GetTokenFromConfidentialAuthCodeResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -226,60 +228,27 @@ public GetTokenFromConfidentialAuthCodeResponse handleResponse(HttpResponse() { - }); - res.withAuthorizationCodeGrantResponse(out); - return res; + return res.withAuthorizationCodeGrantResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - OAuthErrorResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw OAuthErrorResponse.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromJWTGrant.java b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromJWTGrant.java index c07863d..49c770d 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromJWTGrant.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromJWTGrant.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -29,6 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -137,7 +139,7 @@ HttpRequest buildRequest(T request, TypeReference typeReference) throws "form", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -176,7 +178,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(JWTGrant request) throws Exception { + public HttpResponse doRequest(JWTGrant request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -198,12 +200,12 @@ public HttpResponse doRequest(JWTGrant request) throws Exception { .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetTokenFromJWTGrantResponse handleResponse(HttpResponse response) throws Exception { + public GetTokenFromJWTGrantResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -219,60 +221,27 @@ public GetTokenFromJWTGrantResponse handleResponse(HttpResponse res if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - JWTGrantResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withJWTGrantResponse(out); - return res; + return res.withJWTGrantResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - OAuthErrorResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw OAuthErrorResponse.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromPublicAuthCode.java b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromPublicAuthCode.java index db06aa0..fd3964e 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromPublicAuthCode.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromPublicAuthCode.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -29,6 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -137,7 +139,7 @@ HttpRequest buildRequest(T request, TypeReference typeReference) throws "form", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -176,7 +178,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(PublicAuthCodeGrantRequestBody request) throws Exception { + public HttpResponse doRequest(PublicAuthCodeGrantRequestBody request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -198,12 +200,12 @@ public HttpResponse doRequest(PublicAuthCodeGrantRequestBody reques .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetTokenFromPublicAuthCodeResponse handleResponse(HttpResponse response) throws Exception { + public GetTokenFromPublicAuthCodeResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -219,60 +221,27 @@ public GetTokenFromPublicAuthCodeResponse handleResponse(HttpResponse() { - }); - res.withAuthorizationCodeGrantResponse(out); - return res; + return res.withAuthorizationCodeGrantResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - OAuthErrorResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw OAuthErrorResponse.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromRefreshToken.java b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromRefreshToken.java index 05434e9..4890c0c 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromRefreshToken.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetTokenFromRefreshToken.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -30,6 +31,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -142,7 +144,7 @@ HttpRequest buildRequest(T request, TypeReference typeReference) throws "form", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -183,7 +185,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(AuthorizationCodeGrant request) throws Exception { + public HttpResponse doRequest(AuthorizationCodeGrant request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -205,12 +207,12 @@ public HttpResponse doRequest(AuthorizationCodeGrant request) throw .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetTokenFromRefreshTokenResponse handleResponse(HttpResponse response) throws Exception { + public GetTokenFromRefreshTokenResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -226,60 +228,27 @@ public GetTokenFromRefreshTokenResponse handleResponse(HttpResponse if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - GetTokenFromRefreshTokenResponseBody out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withObject(out); - return res; + return res.withObject(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - OAuthErrorResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw OAuthErrorResponse.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetUserInfo.java b/src/main/java/com/docusign/iam/sdk/operations/GetUserInfo.java index ebbec6d..5867f6e 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetUserInfo.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetUserInfo.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestlessOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -159,7 +160,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest() throws Exception { + public HttpResponse doRequest() { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -181,12 +182,12 @@ public HttpResponse doRequest() throws Exception { .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetUserInfoResponse handleResponse(HttpResponse response) throws Exception { + public GetUserInfoResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -202,60 +203,27 @@ public GetUserInfoResponse handleResponse(HttpResponse response) th if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - UserInfo out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUserInfo(out); - return res; + return res.withUserInfo(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - OAuthErrorResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw OAuthErrorResponse.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstance.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstance.java index a3cf47c..339ad32 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstance.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstance.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -143,7 +144,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkflowInstanceRequest request) throws Exception { + public HttpResponse doRequest(GetWorkflowInstanceRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -165,12 +166,12 @@ public HttpResponse doRequest(GetWorkflowInstanceRequest request) t .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkflowInstanceResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkflowInstanceResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -186,76 +187,34 @@ public GetWorkflowInstanceResponse handleResponse(HttpResponse resp if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - WorkflowInstance out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withWorkflowInstance(out); - return res; + return res.withWorkflowInstance(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstancesList.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstancesList.java index de8c76d..6fafc45 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstancesList.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowInstancesList.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkflowInstancesListRequest request) throws Exception { + public HttpResponse doRequest(GetWorkflowInstancesListRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(GetWorkflowInstancesListRequest reque .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkflowInstancesListResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkflowInstancesListResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,44 +186,20 @@ public GetWorkflowInstancesListResponse handleResponse(HttpResponse if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - WorkflowInstanceCollection out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withWorkflowInstanceCollection(out); - return res; + return res.withWorkflowInstanceCollection(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowTriggerRequirements.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowTriggerRequirements.java index d2b33a3..288c514 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowTriggerRequirements.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowTriggerRequirements.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -143,7 +144,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkflowTriggerRequirementsRequest request) throws Exception { + public HttpResponse doRequest(GetWorkflowTriggerRequirementsRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -165,12 +166,12 @@ public HttpResponse doRequest(GetWorkflowTriggerRequirementsRequest .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkflowTriggerRequirementsResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkflowTriggerRequirementsResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -186,76 +187,34 @@ public GetWorkflowTriggerRequirementsResponse handleResponse(HttpResponse() { - }); - res.withWorkflowTriggerRequirementsSuccess(out); - return res; + return res.withWorkflowTriggerRequirementsSuccess(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowsList.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowsList.java index f839ae8..67147b1 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowsList.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkflowsList.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -148,7 +149,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkflowsListRequest request) throws Exception { + public HttpResponse doRequest(GetWorkflowsListRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -170,12 +171,12 @@ public HttpResponse doRequest(GetWorkflowsListRequest request) thro .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkflowsListResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkflowsListResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -191,76 +192,34 @@ public GetWorkflowsListResponse handleResponse(HttpResponse respons if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - WorkflowsListSuccess out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withWorkflowsListSuccess(out); - return res; + return res.withWorkflowsListSuccess(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspace.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspace.java index cba0d23..baa22dc 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspace.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspace.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(GetWorkspaceRequest request) throws E .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,76 +186,34 @@ public GetWorkspaceResponse handleResponse(HttpResponse response) t if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.GetWorkspaceResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetWorkspaceResponse(out); - return res; + return res.withGetWorkspaceResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceAssignableRoles.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceAssignableRoles.java index 17bf04a..9263a5f 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceAssignableRoles.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceAssignableRoles.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -147,7 +148,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceAssignableRolesRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceAssignableRolesRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -169,12 +170,12 @@ public HttpResponse doRequest(GetWorkspaceAssignableRolesRequest re .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceAssignableRolesResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceAssignableRolesResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -190,76 +191,34 @@ public GetWorkspaceAssignableRolesResponse handleResponse(HttpResponse() { - }); - res.withGetWorkspaceAssignableRolesResponse(out); - return res; + return res.withGetWorkspaceAssignableRolesResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceBrand.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceBrand.java new file mode 100644 index 0000000..07c640c --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceBrand.java @@ -0,0 +1,219 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.operations; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; +import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; + +import com.docusign.iam.sdk.SDKConfiguration; +import com.docusign.iam.sdk.SecuritySource; +import com.docusign.iam.sdk.models.errors.APIException; +import com.docusign.iam.sdk.models.errors.ErrorDetails; +import com.docusign.iam.sdk.models.operations.GetWorkspaceBrandRequest; +import com.docusign.iam.sdk.models.operations.GetWorkspaceBrandResponse; +import com.docusign.iam.sdk.utils.BackoffStrategy; +import com.docusign.iam.sdk.utils.HTTPClient; +import com.docusign.iam.sdk.utils.HTTPRequest; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Hook.AfterErrorContextImpl; +import com.docusign.iam.sdk.utils.Hook.AfterSuccessContextImpl; +import com.docusign.iam.sdk.utils.Hook.BeforeRequestContextImpl; +import com.docusign.iam.sdk.utils.Options; +import com.docusign.iam.sdk.utils.Retries; +import com.docusign.iam.sdk.utils.RetryConfig; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + + +public class GetWorkspaceBrand { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final List retryStatusCodes; + final RetryConfig retryConfig; + final HTTPClient client; + final Headers _headers; + + public Base( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + options + .ifPresent(o -> o.validate(List.of(Options.Option.RETRY_CONFIG))); + this.retryStatusCodes = List.of("5XX", "429"); + this.retryConfig = options + .flatMap(Options::retryConfig) + .or(sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder().backoff(BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(5000, TimeUnit.MILLISECONDS) + .baseFactor((double) (1.5)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build()); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWorkspaceBrand", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWorkspaceBrand", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWorkspaceBrand", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/v1/accounts/{accountId}/workspaces/{workspaceId}/brand", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + super( + sdkConfiguration, options, + _headers); + } + + private HttpRequest onBuildRequest(GetWorkspaceBrandRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWorkspaceBrandRequest.class); + 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(GetWorkspaceBrandRequest request) { + Retries retries = Retries.builder() + .action(() -> { + HttpRequest r; + try { + r = onBuildRequest(request); + } catch (Exception e) { + throw new NonRetryableException(e); + } + try { + HttpResponse httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "500", "5XX")) { + return onError(httpRes, null); + } + return httpRes; + } catch (Exception e) { + return onError(null, e); + } + }) + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .build(); + return unchecked(() -> onSuccess(retries.run())).get(); + } + + + @Override + public GetWorkspaceBrandResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetWorkspaceBrandResponse.Builder resBuilder = + GetWorkspaceBrandResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetWorkspaceBrandResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withGetWorkspaceBrandResponse(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw ErrorDetails.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 ErrorDetails.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); + } + } +} diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocument.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocument.java index 51bd1e6..c48c205 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocument.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocument.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceDocumentRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceDocumentRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(GetWorkspaceDocumentRequest request) .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceDocumentResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceDocumentResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,76 +186,34 @@ public GetWorkspaceDocumentResponse handleResponse(HttpResponse res if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.GetWorkspaceDocumentResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetWorkspaceDocumentResponse(out); - return res; + return res.withGetWorkspaceDocumentResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocumentContents.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocumentContents.java index e6b571e..c4b836a 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocumentContents.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocumentContents.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -23,7 +24,6 @@ import com.docusign.iam.sdk.utils.Retries; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; import java.lang.String; @@ -142,7 +142,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceDocumentContentsRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceDocumentContentsRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +164,12 @@ public HttpResponse doRequest(GetWorkspaceDocumentContentsRequest r .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceDocumentContentsResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceDocumentContentsResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -190,69 +190,32 @@ public GetWorkspaceDocumentContentsResponse handleResponse(HttpResponse() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocuments.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocuments.java index ca9812b..22a997f 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocuments.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceDocuments.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -147,7 +148,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceDocumentsRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceDocumentsRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -169,12 +170,12 @@ public HttpResponse doRequest(GetWorkspaceDocumentsRequest request) .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceDocumentsResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceDocumentsResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -190,76 +191,34 @@ public GetWorkspaceDocumentsResponse handleResponse(HttpResponse re if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.GetWorkspaceDocumentsResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetWorkspaceDocumentsResponse(out); - return res; + return res.withGetWorkspaceDocumentsResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceEnvelopes.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceEnvelopes.java index 39649f6..406177d 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceEnvelopes.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceEnvelopes.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceEnvelopesRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceEnvelopesRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(GetWorkspaceEnvelopesRequest request) .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceEnvelopesResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceEnvelopesResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,76 +186,34 @@ public GetWorkspaceEnvelopesResponse handleResponse(HttpResponse re if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.GetWorkspaceEnvelopesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetWorkspaceEnvelopesResponse(out); - return res; + return res.withGetWorkspaceEnvelopesResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequest.java index 42d7f85..940b665 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequest.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceUploadRequestRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceUploadRequestRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(GetWorkspaceUploadRequestRequest requ .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceUploadRequestResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceUploadRequestResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,76 +186,34 @@ public GetWorkspaceUploadRequestResponse handleResponse(HttpResponse() { - }); - res.withGetWorkspaceUploadRequestResponse(out); - return res; + return res.withGetWorkspaceUploadRequestResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequests.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequests.java index cd19554..242dac6 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequests.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUploadRequests.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -142,7 +143,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceUploadRequestsRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceUploadRequestsRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +165,12 @@ public HttpResponse doRequest(GetWorkspaceUploadRequestsRequest req .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceUploadRequestsResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceUploadRequestsResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -185,76 +186,34 @@ public GetWorkspaceUploadRequestsResponse handleResponse(HttpResponse() { - }); - res.withGetWorkspaceUploadRequestsResponse(out); - return res; + return res.withGetWorkspaceUploadRequestsResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUsers.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUsers.java index ef755a7..d40086e 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUsers.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaceUsers.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -147,7 +148,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspaceUsersRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspaceUsersRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -169,12 +170,12 @@ public HttpResponse doRequest(GetWorkspaceUsersRequest request) thr .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspaceUsersResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspaceUsersResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -190,76 +191,34 @@ public GetWorkspaceUsersResponse handleResponse(HttpResponse respon if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.GetWorkspaceUsersResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetWorkspaceUsersResponse(out); - return res; + return res.withGetWorkspaceUsersResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "404", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaces.java b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaces.java index 78e7758..1f0d3f0 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaces.java +++ b/src/main/java/com/docusign/iam/sdk/operations/GetWorkspaces.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -147,7 +148,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(GetWorkspacesRequest request) throws Exception { + public HttpResponse doRequest(GetWorkspacesRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -169,12 +170,12 @@ public HttpResponse doRequest(GetWorkspacesRequest request) throws .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public GetWorkspacesResponse handleResponse(HttpResponse response) throws Exception { + public GetWorkspacesResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -190,76 +191,34 @@ public GetWorkspacesResponse handleResponse(HttpResponse response) if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.GetWorkspacesResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withGetWorkspacesResponse(out); - return res; + return res.withGetWorkspacesResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/Operations.java b/src/main/java/com/docusign/iam/sdk/operations/Operations.java index f238600..cc778a4 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/Operations.java +++ b/src/main/java/com/docusign/iam/sdk/operations/Operations.java @@ -13,20 +13,20 @@ public class Operations { * Base interface for all operations */ public interface Operation { - ResT handleResponse(HttpResponse response) throws Exception; + ResT handleResponse(HttpResponse response); } /** * Interface for operations that require a request parameter */ public interface RequestOperation extends Operation { - HttpResponse doRequest(ReqT request) throws Exception; + HttpResponse doRequest(ReqT request); } /** * Interface for operations that don't require a request parameter */ public interface RequestlessOperation extends Operation { - HttpResponse doRequest() throws Exception; + HttpResponse doRequest(); } } \ No newline at end of file diff --git a/src/main/java/com/docusign/iam/sdk/operations/PauseNewWorkflowInstances.java b/src/main/java/com/docusign/iam/sdk/operations/PauseNewWorkflowInstances.java index fcda5aa..7447966 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/PauseNewWorkflowInstances.java +++ b/src/main/java/com/docusign/iam/sdk/operations/PauseNewWorkflowInstances.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -143,7 +144,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(PauseNewWorkflowInstancesRequest request) throws Exception { + public HttpResponse doRequest(PauseNewWorkflowInstancesRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -165,12 +166,12 @@ public HttpResponse doRequest(PauseNewWorkflowInstancesRequest requ .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public PauseNewWorkflowInstancesResponse handleResponse(HttpResponse response) throws Exception { + public PauseNewWorkflowInstancesResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -186,76 +187,34 @@ public PauseNewWorkflowInstancesResponse handleResponse(HttpResponse() { - }); - res.withPauseNewWorkflowInstancesSuccess(out); - return res; + return res.withPauseNewWorkflowInstancesSuccess(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/RestoreWorkspaceUserAccess.java b/src/main/java/com/docusign/iam/sdk/operations/RestoreWorkspaceUserAccess.java index b821faa..2a49418 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/RestoreWorkspaceUserAccess.java +++ b/src/main/java/com/docusign/iam/sdk/operations/RestoreWorkspaceUserAccess.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -23,7 +24,6 @@ import com.docusign.iam.sdk.utils.Retries; import com.docusign.iam.sdk.utils.RetryConfig; import com.docusign.iam.sdk.utils.Utils; -import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; import java.lang.String; @@ -142,7 +142,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(RestoreWorkspaceUserAccessRequest request) throws Exception { + public HttpResponse doRequest(RestoreWorkspaceUserAccessRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -164,12 +164,12 @@ public HttpResponse doRequest(RestoreWorkspaceUserAccessRequest req .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public RestoreWorkspaceUserAccessResponse handleResponse(HttpResponse response) throws Exception { + public RestoreWorkspaceUserAccessResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -187,62 +187,29 @@ public RestoreWorkspaceUserAccessResponse handleResponse(HttpResponse() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/ResumePausedWorkflow.java b/src/main/java/com/docusign/iam/sdk/operations/ResumePausedWorkflow.java index ea7a0db..77c06c4 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/ResumePausedWorkflow.java +++ b/src/main/java/com/docusign/iam/sdk/operations/ResumePausedWorkflow.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -143,7 +144,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(ResumePausedWorkflowRequest request) throws Exception { + public HttpResponse doRequest(ResumePausedWorkflowRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -165,12 +166,12 @@ public HttpResponse doRequest(ResumePausedWorkflowRequest request) .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public ResumePausedWorkflowResponse handleResponse(HttpResponse response) throws Exception { + public ResumePausedWorkflowResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -186,76 +187,34 @@ public ResumePausedWorkflowResponse handleResponse(HttpResponse res if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ResumeNewWorkflowInstancesSuccess out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withResumeNewWorkflowInstancesSuccess(out); - return res; + return res.withResumeNewWorkflowInstancesSuccess(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404", "409")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/RevokeWorkspaceUserAccess.java b/src/main/java/com/docusign/iam/sdk/operations/RevokeWorkspaceUserAccess.java index ce99df4..4295b35 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/RevokeWorkspaceUserAccess.java +++ b/src/main/java/com/docusign/iam/sdk/operations/RevokeWorkspaceUserAccess.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -155,7 +156,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(RevokeWorkspaceUserAccessRequest request) throws Exception { + public HttpResponse doRequest(RevokeWorkspaceUserAccessRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -177,12 +178,12 @@ public HttpResponse doRequest(RevokeWorkspaceUserAccessRequest requ .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public RevokeWorkspaceUserAccessResponse handleResponse(HttpResponse response) throws Exception { + public RevokeWorkspaceUserAccessResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -200,62 +201,29 @@ public RevokeWorkspaceUserAccessResponse handleResponse(HttpResponse() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/TriggerWorkflow.java b/src/main/java/com/docusign/iam/sdk/operations/TriggerWorkflow.java index a1946b2..7dfaaa9 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/TriggerWorkflow.java +++ b/src/main/java/com/docusign/iam/sdk/operations/TriggerWorkflow.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -29,6 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -120,7 +122,7 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR "json", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -159,7 +161,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(TriggerWorkflowRequest request) throws Exception { + public HttpResponse doRequest(TriggerWorkflowRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -181,12 +183,12 @@ public HttpResponse doRequest(TriggerWorkflowRequest request) throw .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public TriggerWorkflowResponse handleResponse(HttpResponse response) throws Exception { + public TriggerWorkflowResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -202,76 +204,34 @@ public TriggerWorkflowResponse handleResponse(HttpResponse response if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - TriggerWorkflowSuccess out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withTriggerWorkflowSuccess(out); - return res; + return res.withTriggerWorkflowSuccess(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "403", "404")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - Error out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw Error.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "401", "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspace.java b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspace.java new file mode 100644 index 0000000..0504e7a --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspace.java @@ -0,0 +1,236 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.operations; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; +import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; + +import com.docusign.iam.sdk.SDKConfiguration; +import com.docusign.iam.sdk.SecuritySource; +import com.docusign.iam.sdk.models.errors.APIException; +import com.docusign.iam.sdk.models.errors.ErrorDetails; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceRequest; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceResponse; +import com.docusign.iam.sdk.utils.BackoffStrategy; +import com.docusign.iam.sdk.utils.HTTPClient; +import com.docusign.iam.sdk.utils.HTTPRequest; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Hook.AfterErrorContextImpl; +import com.docusign.iam.sdk.utils.Hook.AfterSuccessContextImpl; +import com.docusign.iam.sdk.utils.Hook.BeforeRequestContextImpl; +import com.docusign.iam.sdk.utils.Options; +import com.docusign.iam.sdk.utils.Retries; +import com.docusign.iam.sdk.utils.RetryConfig; +import com.docusign.iam.sdk.utils.SerializedBody; +import com.docusign.iam.sdk.utils.Utils.JsonShape; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + + +public class UpdateWorkspace { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final List retryStatusCodes; + final RetryConfig retryConfig; + final HTTPClient client; + final Headers _headers; + + public Base( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + options + .ifPresent(o -> o.validate(List.of(Options.Option.RETRY_CONFIG))); + this.retryStatusCodes = List.of("5XX", "429"); + this.retryConfig = options + .flatMap(Options::retryConfig) + .or(sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder().backoff(BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(5000, TimeUnit.MILLISECONDS) + .baseFactor((double) (1.5)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build()); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWorkspace", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWorkspace", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWorkspace", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/v1/accounts/{accountId}/workspaces/{workspaceId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PUT"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "updateWorkspaceBody", + "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))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + super( + sdkConfiguration, options, + _headers); + } + + private HttpRequest onBuildRequest(UpdateWorkspaceRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateWorkspaceRequest.class, 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(UpdateWorkspaceRequest request) { + Retries retries = Retries.builder() + .action(() -> { + HttpRequest r; + try { + r = onBuildRequest(request); + } catch (Exception e) { + throw new NonRetryableException(e); + } + try { + HttpResponse httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "500", "5XX")) { + return onError(httpRes, null); + } + return httpRes; + } catch (Exception e) { + return onError(null, e); + } + }) + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .build(); + return unchecked(() -> onSuccess(retries.run())).get(); + } + + + @Override + public UpdateWorkspaceResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateWorkspaceResponse.Builder resBuilder = + UpdateWorkspaceResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateWorkspaceResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withUpdateWorkspaceResponse(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw ErrorDetails.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 ErrorDetails.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); + } + } +} diff --git a/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceBrand.java b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceBrand.java new file mode 100644 index 0000000..7c36de4 --- /dev/null +++ b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceBrand.java @@ -0,0 +1,236 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.docusign.iam.sdk.operations; + +import static com.docusign.iam.sdk.operations.Operations.RequestOperation; +import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; + +import com.docusign.iam.sdk.SDKConfiguration; +import com.docusign.iam.sdk.SecuritySource; +import com.docusign.iam.sdk.models.errors.APIException; +import com.docusign.iam.sdk.models.errors.ErrorDetails; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceBrandRequest; +import com.docusign.iam.sdk.models.operations.UpdateWorkspaceBrandResponse; +import com.docusign.iam.sdk.utils.BackoffStrategy; +import com.docusign.iam.sdk.utils.HTTPClient; +import com.docusign.iam.sdk.utils.HTTPRequest; +import com.docusign.iam.sdk.utils.Headers; +import com.docusign.iam.sdk.utils.Hook.AfterErrorContextImpl; +import com.docusign.iam.sdk.utils.Hook.AfterSuccessContextImpl; +import com.docusign.iam.sdk.utils.Hook.BeforeRequestContextImpl; +import com.docusign.iam.sdk.utils.Options; +import com.docusign.iam.sdk.utils.Retries; +import com.docusign.iam.sdk.utils.RetryConfig; +import com.docusign.iam.sdk.utils.SerializedBody; +import com.docusign.iam.sdk.utils.Utils.JsonShape; +import com.docusign.iam.sdk.utils.Utils; +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + + +public class UpdateWorkspaceBrand { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final List retryStatusCodes; + final RetryConfig retryConfig; + final HTTPClient client; + final Headers _headers; + + public Base( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + options + .ifPresent(o -> o.validate(List.of(Options.Option.RETRY_CONFIG))); + this.retryStatusCodes = List.of("5XX", "429"); + this.retryConfig = options + .flatMap(Options::retryConfig) + .or(sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder().backoff(BackoffStrategy.builder() + .initialInterval(500, TimeUnit.MILLISECONDS) + .maxInterval(5000, TimeUnit.MILLISECONDS) + .baseFactor((double) (1.5)) + .maxElapsedTime(30000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build()); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWorkspaceBrand", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWorkspaceBrand", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWorkspaceBrand", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/v1/accounts/{accountId}/workspaces/{workspaceId}/brand", + request, null); + HTTPRequest req = new HTTPRequest(url, "PUT"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "updateWorkspaceBrandBody", + "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))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + super( + sdkConfiguration, options, + _headers); + } + + private HttpRequest onBuildRequest(UpdateWorkspaceBrandRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateWorkspaceBrandRequest.class, 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(UpdateWorkspaceBrandRequest request) { + Retries retries = Retries.builder() + .action(() -> { + HttpRequest r; + try { + r = onBuildRequest(request); + } catch (Exception e) { + throw new NonRetryableException(e); + } + try { + HttpResponse httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "4XX", "500", "5XX")) { + return onError(httpRes, null); + } + return httpRes; + } catch (Exception e) { + return onError(null, e); + } + }) + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .build(); + return unchecked(() -> onSuccess(retries.run())).get(); + } + + + @Override + public UpdateWorkspaceBrandResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateWorkspaceBrandResponse.Builder resBuilder = + UpdateWorkspaceBrandResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateWorkspaceBrandResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withUpdateWorkspaceBrandResponse(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw ErrorDetails.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 ErrorDetails.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); + } + } +} diff --git a/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUploadRequest.java b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUploadRequest.java index 3e64ac7..dfa3a73 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUploadRequest.java +++ b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUploadRequest.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -29,6 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import java.io.InputStream; import java.lang.Exception; +import java.lang.IllegalArgumentException; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -120,7 +122,7 @@ HttpRequest buildRequest(T request, Class klass, TypeReference typeR "json", false); if (serializedRequestBody == null) { - throw new Exception("Request body is required"); + throw new IllegalArgumentException("Request body is required"); } req.setBody(Optional.ofNullable(serializedRequestBody)); req.addHeader("Accept", "application/json") @@ -159,7 +161,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(UpdateWorkspaceUploadRequestRequest request) throws Exception { + public HttpResponse doRequest(UpdateWorkspaceUploadRequestRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -181,12 +183,12 @@ public HttpResponse doRequest(UpdateWorkspaceUploadRequestRequest r .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public UpdateWorkspaceUploadRequestResponse handleResponse(HttpResponse response) throws Exception { + public UpdateWorkspaceUploadRequestResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -202,76 +204,34 @@ public UpdateWorkspaceUploadRequestResponse handleResponse(HttpResponse() { - }); - res.withGetWorkspaceUploadRequestResponse(out); - return res; + return res.withGetWorkspaceUploadRequestResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUser.java b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUser.java index 26817bf..9f7a3ea 100644 --- a/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUser.java +++ b/src/main/java/com/docusign/iam/sdk/operations/UpdateWorkspaceUser.java @@ -5,6 +5,7 @@ import static com.docusign.iam.sdk.operations.Operations.RequestOperation; import static com.docusign.iam.sdk.utils.Retries.NonRetryableException; +import static com.docusign.iam.sdk.utils.Exceptions.unchecked; import com.docusign.iam.sdk.SDKConfiguration; import com.docusign.iam.sdk.SecuritySource; @@ -155,7 +156,7 @@ private HttpResponse onSuccess(HttpResponse response) } @Override - public HttpResponse doRequest(UpdateWorkspaceUserRequest request) throws Exception { + public HttpResponse doRequest(UpdateWorkspaceUserRequest request) { Retries retries = Retries.builder() .action(() -> { HttpRequest r; @@ -177,12 +178,12 @@ public HttpResponse doRequest(UpdateWorkspaceUserRequest request) t .retryConfig(retryConfig) .statusCodes(retryStatusCodes) .build(); - return onSuccess(retries.run()); + return unchecked(() -> onSuccess(retries.run())).get(); } @Override - public UpdateWorkspaceUserResponse handleResponse(HttpResponse response) throws Exception { + public UpdateWorkspaceUserResponse handleResponse(HttpResponse response) { String contentType = response .headers() .firstValue("Content-Type") @@ -198,76 +199,34 @@ public UpdateWorkspaceUserResponse handleResponse(HttpResponse resp if (Utils.statusCodeMatches(response.statusCode(), "200")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - com.docusign.iam.sdk.models.components.UpdateWorkspaceUserResponse out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - res.withUpdateWorkspaceUserResponse(out); - return res; + return res.withUpdateWorkspaceUserResponse(Utils.unmarshal(response, new TypeReference() {})); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "400", "401")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "500")) { if (Utils.contentTypeMatches(contentType, "application/json")) { - ErrorDetails out = Utils.mapper().readValue( - response.body(), - new TypeReference<>() { - }); - throw out; + throw ErrorDetails.from(response); } else { - throw new APIException( - response, - response.statusCode(), - "Unexpected content-type received: " + contentType, - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected content-type received: " + contentType, response); } } - if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { // no content - throw new APIException( - response, - response.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(response)); + throw APIException.from("API error occurred", response); } - - throw new APIException( - response, - response.statusCode(), - "Unexpected status code received: " + response.statusCode(), - Utils.extractByteArrayFromBody(response)); + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); } } } diff --git a/src/main/java/com/docusign/iam/sdk/utils/SessionManager.java b/src/main/java/com/docusign/iam/sdk/utils/SessionManager.java index 86337b6..e96a159 100644 --- a/src/main/java/com/docusign/iam/sdk/utils/SessionManager.java +++ b/src/main/java/com/docusign/iam/sdk/utils/SessionManager.java @@ -10,6 +10,7 @@ import java.net.URISyntaxException; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -174,12 +175,19 @@ public static Session requestOAuth2Token(HTTPClient HttpResponse response = client.send(request); if (response.statusCode() != HttpURLConnection.HTTP_OK) { String responseBody = Utils.toUtf8AndClose(response.body()); - throw new AuthException(response.statusCode(), - "Unexpected status code " + response.statusCode() + ": " + responseBody); + throw new AuthException( + "Unexpected status code " + response.statusCode() + ": " + responseBody, + response.statusCode(), + responseBody.getBytes(StandardCharsets.UTF_8), + response); } TokenResponse t = Utils.mapper().readValue(response.body(), TokenResponse.class); if (!t.tokenType.orElse("").toLowerCase().equals("bearer")) { - throw new AuthException("Expected 'Bearer' token type but was '" + t.tokenType.orElse("") + "'"); + throw new AuthException( + "Expected 'Bearer' token type but was '" + t.tokenType.orElse("") + "'", + response.statusCode(), + Utils.readBytesAndClose(response.body()), + response); } final Optional expiresAt = t.expiresInSeconds .map(x -> OffsetDateTime.now().plus(x, ChronoUnit.SECONDS)); diff --git a/src/main/java/com/docusign/iam/sdk/utils/Utils.java b/src/main/java/com/docusign/iam/sdk/utils/Utils.java index cd123c6..00cb5b3 100644 --- a/src/main/java/com/docusign/iam/sdk/utils/Utils.java +++ b/src/main/java/com/docusign/iam/sdk/utils/Utils.java @@ -69,6 +69,9 @@ import com.fasterxml.jackson.databind.node.TextNode; import com.fasterxml.jackson.databind.type.TypeFactory; +import com.docusign.iam.sdk.models.errors.APIException; + + public final class Utils { private Utils() { @@ -1408,11 +1411,16 @@ private static List toList(Iterator it) { public static T valueOrElse(T value, T valueIfNotPresent) { return value != null ? value : valueIfNotPresent; } - + public static T valueOrElse(Optional value, T valueIfNotPresent) { + if (value == null) { + // this defensive check is used in custom exception class constructors + // to simplify calling code + return valueIfNotPresent; + } return value.orElse(valueIfNotPresent); } - + public static T valueOrElse(JsonNullable value, T valueIfNotPresent) { if (value.isPresent()) { return value.get(); @@ -1420,15 +1428,15 @@ public static T valueOrElse(JsonNullable value, T valueIfNotPresent) { return valueIfNotPresent; } } - + public static T valueOrNull(T value) { return valueOrElse(value, null); } - + public static T valueOrNull(Optional value) { return valueOrElse(value, null); } - + public static T valueOrNull(JsonNullable value) { return valueOrElse(value, null); } @@ -1597,4 +1605,15 @@ private static BigDecimal toBigDecimal(Number number) { return BigDecimal.valueOf(number.doubleValue()); } } + + public static T unmarshal(HttpResponse response, TypeReference typeReference) { + try { + return mapper().readValue( + Utils.extractByteArrayFromBody(response), + typeReference); + } catch (Exception e) { + throw APIException.from( + "Error deserializing response body: " + e.getMessage(), response, e); + } + } }