diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml new file mode 100644 index 00000000..e098fe46 --- /dev/null +++ b/.github/workflows/CI.yaml @@ -0,0 +1,29 @@ +name: CI +on: + push: + pull_request: + branches: + - master + +jobs: + unit-java-sdk: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Execute Gradle build + run: ./gradlew check + env: + UNIT_API_URL: ${{ secrets.UNIT_API_URL }} + UNIT_TOKEN: ${{ secrets.UNIT_TOKEN }} + access_token: ${{ secrets.UNIT_TOKEN }} diff --git a/.github/workflows/publish-maven.yaml b/.github/workflows/publish-maven.yaml new file mode 100644 index 00000000..d552b8a3 --- /dev/null +++ b/.github/workflows/publish-maven.yaml @@ -0,0 +1,25 @@ +name: Publish to Maven +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + - name: Run chmod to make gradlew executable + run: chmod +x ./gradlew + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Publish package + uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 + with: + arguments: publish + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0a44195c --- /dev/null +++ b/.gitignore @@ -0,0 +1,85 @@ +############################## +## Java +############################## +.mtj.tmp/ +*.class +*.jar +*.war +*.ear +*.nar +hs_err_pid* +replay_pid* + +############################## +## Maven +############################## +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +pom.xml.bak +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +############################## +## Gradle +############################## +bin/ +build/ +.gradle +.gradletasknamecache +gradle-app.setting +!gradle-wrapper.jar + +############################## +## IntelliJ +############################## +out/ +.idea/ +.idea_modules/ +*.iml +*.ipr +*.iws + +############################## +## Eclipse +############################## +.settings/ +bin/ +tmp/ +.metadata +.classpath +.project +*.tmp +*.bak +*.swp +*~.nib +local.properties +.loadpath +.factorypath + +############################## +## NetBeans +############################## +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml + +############################## +## Visual Studio Code +############################## +.vscode/ +.code-workspace + +############################## +## OS X +############################## +.DS_Store \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..1b6741c0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 00000000..eb73fc6c --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,14369 @@ +openapi: 3.0.2 +info: + description: An OpenAPI specifications for unit-sdk clients + title: Unit OpenAPI specifications + version: 0.2.0 +servers: +- url: https://api.s.unit.sh +security: +- bearerAuth: [] +paths: + /applications/{applicationId}: + get: + description: 'Get an Application from API ' + operationId: execute + parameters: + - description: ID of the application to get + in: path + name: applicationId + required: true + schema: + type: string + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitApplicationResponseWithIncluded' + description: Successful Response + summary: Get Application by Id + tags: + - Get Application + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update an Application via API ' + operationId: execute + parameters: + - description: ID of the application to update + in: path + name: applicationId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_application' + description: Update Application Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitApplicationResponseWithIncluded' + description: Successful Response + summary: Update Application + tags: + - Update Application + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/cancel: + post: + description: 'Cancel a Application via API ' + operationId: execute + parameters: + - description: ID of the application to get + in: path + name: applicationId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request' + description: Cancel Application Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCancelApplicationResponse' + description: Successful Response + summary: Cancel Application by Id + tags: + - Cancel Application + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /applications: + get: + description: 'Get List Applications from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitListApplicationsResponse' + description: Successful Response + default: + content: + application/json: + schema: + $ref: '#/components/schemas/UnitError' + description: Unexpected error + summary: Get List Application + tags: + - Get List Applications + x-accepts: application/json + post: + description: 'Create an Application via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/createApplication' + description: Create Application Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCreateApplicationResponse' + description: Successful Response + summary: Create Application + tags: + - Create Application + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /application-forms: + get: + description: 'Get List Application Forms from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_1' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitApplicationFormsListResponse' + description: Successful Response + summary: Get List Application Forms + tags: + - Get List Application Forms + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create an Application Form via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_1' + description: Create Application Form Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitApplicationFormResponse' + description: Successful Response + summary: Create Application Form + tags: + - Create ApplicationForm + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /applications/{applicationId}/documents/{documentId}: + put: + description: 'Upload a PDF file via API ' + operationId: execute + parameters: + - description: ID of the application to upload a file to + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to upload a file for + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + application/pdf: + schema: + type: object + description: Upload PDF File + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Upload a PDF document + tags: + - Upload a PDF Document for an Application + x-content-type: application/pdf + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/: + put: + description: 'Upload a PNG file via API ' + operationId: execute + parameters: + - description: ID of the application to upload a file to + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to upload a file for + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + image/png: + schema: + type: object + description: Upload PNG File + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Upload a PNG document + tags: + - Upload a PNG Document for an Application + x-content-type: image/png + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/?: + put: + description: 'Upload a JPEG file via API ' + operationId: execute + parameters: + - description: ID of the application to upload a file to + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to upload a file for + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + image/jpeg: + schema: + type: object + description: Upload JPEG File + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Upload a JPEG document + tags: + - Upload a JPEG Document for an Application + x-content-type: image/jpeg + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/back: + put: + description: Upload a PDF file via API - Back Side + operationId: execute + parameters: + - description: ID of the application to upload a file to + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to upload a file for + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + application/pdf: + schema: + type: object + description: Upload PDF File - Back Side + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Upload a PDF document - Back Side + tags: + - Upload a PDF Document for an Application - Back Side + x-content-type: application/pdf + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/back/: + put: + description: Upload a PNG file via API - Back Side + operationId: execute + parameters: + - description: ID of the application to upload a file to + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to upload a file for + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + image/png: + schema: + type: object + description: Upload PNG File - Back Side + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Upload a PNG document - Back Side + tags: + - Upload a PNG Document for an Application - Back Side + x-content-type: image/png + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/back/?: + put: + description: Upload a JPEG file via API - Back Side + operationId: execute + parameters: + - description: ID of the application to upload a file to + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to upload a file for + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + image/jpeg: + schema: + type: object + description: Upload JPEG File - Back Side + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Upload a JPEG document - Back Side + tags: + - Upload a JPEG Document for an Application - Back Side + x-content-type: image/jpeg + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents: + get: + description: 'Get List of Documents via API ' + operationId: execute + parameters: + - description: ID of the application to get documents for + in: path + name: applicationId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/execute_200_response' + description: Successful Response + summary: Get List of Documents + tags: + - Get List of Documents + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a document via API ' + operationId: execute + parameters: + - description: ID of the application to create a file for + in: path + name: applicationId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Create a document + tags: + - Create a Document for an Application + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/verify: + put: + description: 'Verify a document via API ' + operationId: execute + parameters: + - description: ID of the application to verify a file for + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to verify + in: path + name: documentId + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/execute_request_2' + description: Verify Document + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDocumentResponse' + description: Successful Response + summary: Verify a document + tags: + - Verify a Document for an Application + x-content-type: application/json + x-accepts: application/vnd.api+json; charset=utf-8 + /applications/{applicationId}/documents/{documentId}/download: + get: + description: 'Download a Document via API ' + operationId: execute + parameters: + - description: ID of the application + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to download + in: path + name: documentId + required: true + schema: + type: string + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: Successful Response + summary: Download a Document + tags: + - Download a Document + x-accepts: application/octet-stream + /applications/{applicationId}/documents/{documentId}/download/back: + get: + description: Download a Document - Back Side via API + operationId: execute + parameters: + - description: ID of the application + in: path + name: applicationId + required: true + schema: + type: string + - description: ID of the document to download + in: path + name: documentId + required: true + schema: + type: string + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: Successful Response + summary: Download a Document - Back Side + tags: + - Download a Document - Back Side + x-accepts: application/octet-stream + /application-forms/{applicationFormId}: + get: + description: 'Get an Application Form from API ' + operationId: execute + parameters: + - description: ID of the application form to get + in: path + name: applicationFormId + required: true + schema: + type: string + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitApplicationFormResponseWithIncluded' + description: Successful Response + summary: Get ApplicationForm by Id + tags: + - Get Application Form + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts: + get: + description: 'Get List Accounts from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_2' + style: deepObject + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountsListResponse' + description: Successful Response + "401": {} + summary: Get List Accounts + tags: + - Get List Accounts + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create Account via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/createAccount' + description: Create Account Request + required: true + responses: + "201": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Create Account + tags: + - Create Account + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}: + get: + description: 'Get an Account from API ' + operationId: execute + parameters: + - description: ID of the account to get + in: path + name: accountId + required: true + schema: + type: string + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponseWithIncluded' + description: Successful Response + summary: Get Account by Id + tags: + - Get Account + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update an Account via API ' + operationId: execute + parameters: + - description: ID of the account to update + in: path + name: accountId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/patch_account' + description: Update Account Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Update Account + tags: + - Update Account + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /accounts/{accountId}/limits: + get: + description: 'Get Account Limits from API ' + operationId: execute + parameters: + - description: ID of the account to get + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitGetAccountLimitsResponse' + description: Successful Response + summary: Get Account Limits by Id + tags: + - Get Account Limits + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/unfreeze: + post: + description: 'Unfreeze an Account via API ' + operationId: execute + parameters: + - description: ID of the account to get + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Unfreeze Account by Id + tags: + - Unfreeze Account + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/freeze: + post: + description: 'Freeze Account via API ' + operationId: execute + parameters: + - description: ID of the account to freeze + in: path + name: accountId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_3' + description: Freeze Account Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Freeze Account by Id + tags: + - Freeze an Account + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/close: + post: + description: 'Close an Account via API ' + operationId: execute + parameters: + - description: ID of the account to close + in: path + name: accountId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_4' + description: Close Account Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Close an Account by Id + tags: + - Close an Account + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/reopen: + post: + description: 'Reopen an Account via API ' + operationId: execute + parameters: + - description: ID of the account to close + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Reopen an Account by Id + tags: + - Reopen an Account + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/enter-daca: + post: + description: 'Enter Control Agreement for Account via API ' + operationId: execute + parameters: + - description: ID of the account + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Enter Account Control Agreement by Id + tags: + - Enter Control Agreement for Account + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/activate-daca: + post: + description: 'Activate Control Agreement for Account via API ' + operationId: execute + parameters: + - description: ID of the account + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + default: {} + summary: Activate Account Control Agreement by Id + tags: + - Activate Control Agreement for Account + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/deactivate-daca: + post: + description: Deactivate Control Agreement for Account via API + operationId: execute + parameters: + - description: ID of the account + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAccountResponse' + description: Successful Response + "404": {} + summary: Deactivate Account Control Agreement by Id + tags: + - Deactivate Control Agreement for Account + x-accepts: application/vnd.api+json; charset=utf-8 + /account-end-of-day: + get: + description: 'Get AccountEndOfDay List from API ' + operationId: execute + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitGetAccountEndOfDayListResponse' + description: Successful Response + default: {} + summary: Get AccountEndOfDay List + tags: + - Get list account end-of-day balances history + x-accepts: application/vnd.api+json; charset=utf-8 + /customers/{customerId}: + get: + description: 'Get a Customer from API ' + operationId: execute + parameters: + - description: ID of the customer to get + in: path + name: customerId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCustomerResponse' + description: Successful Response + summary: Get Customer by Id + tags: + - Get Customer + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update an Customer via API ' + operationId: execute + parameters: + - description: ID of the customer to update + in: path + name: customerId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_customer' + description: Update Customer Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCustomerResponse' + description: Successful Response + summary: Update Customer + tags: + - Update Customer + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /customers: + get: + description: 'Get Customers List from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_3' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCustomersListResponse' + description: Successful Response + summary: Get Customers List + tags: + - Get List Customers + x-accepts: application/vnd.api+json; charset=utf-8 + /customers/{customerId}/archive: + post: + description: 'Archive a Customer via API ' + operationId: execute + parameters: + - description: ID of the customer to archive + in: path + name: customerId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_5' + description: Update Payment Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCustomerResponse' + description: Successful Response + summary: Archive Customer by Id + tags: + - Archive Customer + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /payments: + get: + description: 'Get List Payments from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_4' + style: deepObject + - in: query + name: include + schema: + type: string + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitPaymentsListResponse' + description: Successful Response + summary: Get List Payments + tags: + - Get List Payments + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a Payment via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_6' + description: Create Payment Request + required: true + responses: + "201": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitPaymentResponse' + description: Successful Response + summary: Create a Payment + tags: + - Create a Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /payments/{paymentId}: + get: + description: 'Get a Payment from API ' + operationId: execute + parameters: + - description: ID of the payment to get + in: path + name: paymentId + required: true + schema: + type: string + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitPaymentResponseWithIncluded' + description: Successful Response + summary: Get Payment by Id + tags: + - Get Payment + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update an Payment via API ' + operationId: execute + parameters: + - description: ID of the payment to update + in: path + name: paymentId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_payment' + description: Update Payment Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitPaymentResponse' + description: Successful Response + summary: Update Payment + tags: + - Update Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /payments/{paymentId}/cancel: + post: + description: 'Cancel a Payment via API ' + operationId: execute + parameters: + - description: ID of the payment to cancel + in: path + name: paymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitPaymentResponse' + description: Successful Response + summary: Cancel a Payment by Id + tags: + - Cancel Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /received-payments: + get: + description: 'Get Received Payments from API ' + operationId: execute + parameters: + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitReceivedPaymentListResponse' + description: Successful Response + summary: Get Received Payments List + tags: + - Get Received Payments List + x-accepts: application/vnd.api+json; charset=utf-8 + /received-payments/{paymentId}: + get: + description: 'Get a Received Payment from API ' + operationId: execute + parameters: + - description: ID of the payment to get + in: path + name: paymentId + required: true + schema: + type: string + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitReceivedPaymentResponseWithIncluded' + description: Successful Response + summary: Get Received Payment by Id + tags: + - Get Received Payment + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update a Received Payment via API ' + operationId: execute + parameters: + - description: ID of the payment to update + in: path + name: paymentId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_received_payment' + description: Update Received Payment Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitReceivedPaymentResponse' + description: Successful Response + summary: Update Received Payment + tags: + - Update Received Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /received-payments/{paymentId}/advance: + post: + description: 'Advance a Received Payment via API ' + operationId: execute + parameters: + - description: ID of the payment to advance + in: path + name: paymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitReceivedPaymentResponse' + description: Successful Response + summary: Advance Received Payment by Id + tags: + - Advance Received Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /counterparties: + get: + description: 'Get Counterparties List from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_5' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCounterpartiesListResponse' + description: Successful Response + summary: Get Counterparties List + tags: + - Get List Counterparties + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a counterparty via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_7' + description: Create Counterparty Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCounterpartyResponse' + description: Successful Response + summary: Create Counterparty + tags: + - Create Counterparty + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /counterparties/{counterpartyId}: + delete: + description: 'Delete Counterparty via API ' + operationId: execute + parameters: + - description: ID of the counterparty to delete + in: path + name: counterpartyId + required: true + schema: + type: string + responses: + "204": + description: Successful Response + summary: Delete Counterparty by Id + tags: + - Delete Counterparty + x-accepts: application/json + get: + description: 'Get a Counterparty from API ' + operationId: execute + parameters: + - description: ID of the counterparty to get + in: path + name: counterpartyId + required: true + schema: + type: string + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCounterpartyResponse' + description: Successful Response + summary: Get Counterparty by Id + tags: + - Get Counterparty + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update a Counterparty via API ' + operationId: execute + parameters: + - description: ID of the counterparty to update + in: path + name: counterpartyId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_counterparty' + description: Update Counterparty Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCounterpartyResponse' + description: Successful Response + summary: Update Counterparty + tags: + - Update Counterparty + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /counterparties/{counterpartyId}/balance: + get: + description: 'Get Recurring Payment from API ' + operationId: execute + parameters: + - description: ID of the counterparty to get + in: path + name: counterpartyId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCounterpartyResponse_1' + description: Successful Response + summary: Get Counterparty Balance + tags: + - Get Counterparty Balance + x-accepts: application/vnd.api+json; charset=utf-8 + /recurring-payments: + get: + description: 'Get Recurring Payments List from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_6' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRecurringPaymentListResponse' + description: Successful Response + summary: Get Recurring Payments List + tags: + - Get List Recurring Payments + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a Recurring Payment via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_8' + description: Create Recurring Payment Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitRecurringPaymentResponse' + description: Successful Response + summary: Create Recurring Payment + tags: + - Create Recurring Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /recurring-payments/{paymentId}: + get: + description: 'Get Recurring Payment from API ' + operationId: execute + parameters: + - description: ID of the payment to get + in: path + name: paymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRecurringPaymentResponse' + description: Successful Response + summary: Get Recurring Payment + tags: + - Get Recurring Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /recurring-payments/{paymentId}/disable: + post: + description: 'Disable Recurring Payment via API ' + operationId: execute + parameters: + - description: ID of the payment to disable + in: path + name: paymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRecurringPaymentResponse' + description: Successful Response + summary: Disable Recurring Payment + tags: + - Disable Recurring Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /recurring-payments/{paymentId}/enable: + post: + description: 'Enable Recurring Payment via API ' + operationId: execute + parameters: + - description: ID of the payment to enable + in: path + name: paymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRecurringPaymentResponse' + description: Successful Response + summary: Enable Recurring Payment + tags: + - Enable Recurring Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /cards: + get: + description: 'Get List of Cards from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_7' + style: deepObject + - in: query + name: include + schema: + type: string + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponseCardsList' + description: Successful Response + summary: Get List of Cards + tags: + - Get List of Cards + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a Card via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_9' + description: Create Card Request + required: true + responses: + "201": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Create a Card + tags: + - Create a Card + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}: + get: + description: 'Get a Card from API ' + operationId: execute + parameters: + - description: ID of the card to get + in: path + name: cardId + required: true + schema: + type: string + - in: query + name: included + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse_1' + description: Successful Response + summary: Get Card by Id + tags: + - Get Card + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update a Card via API ' + operationId: execute + parameters: + - description: ID of the card to update + in: path + name: cardId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_card' + description: Update Card Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Update Card + tags: + - Update Card + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /cards/{cardId}/secure-data/pin/status: + get: + description: 'Get Card PIN Status via API ' + operationId: execute + parameters: + - description: ID of the card to get PIN status + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse_2' + description: Successful Response + summary: Get Card PIN Status + tags: + - Get Card PIN Status + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}/report-stolen: + post: + description: 'Report card as stolen via API ' + operationId: execute + parameters: + - description: ID of the card + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Report card as stolen + tags: + - Report Card as Stolen + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}/report-lost: + post: + description: 'Report lost as stolen via API ' + operationId: execute + parameters: + - description: ID of the card + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Report lost as stolen + tags: + - Report Card as Lost + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}/close: + post: + description: 'Close a Card via API ' + operationId: execute + parameters: + - description: ID of the card to close + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Close a Card + tags: + - Close a Card + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}/freeze: + post: + description: 'Freeze a Card via API ' + operationId: execute + parameters: + - description: ID of the card to freeze + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Freeze a Card + tags: + - Freeze a Card + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}/unfreeze: + post: + description: 'Unfreeze a Card via API ' + operationId: execute + parameters: + - description: ID of the card to unfreeze + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse' + description: Successful Response + summary: Unfreeze a Card + tags: + - Unfreeze a Card + x-accepts: application/vnd.api+json; charset=utf-8 + /cards/{cardId}/limits: + get: + description: 'Get a Card Limits from API ' + operationId: execute + parameters: + - description: ID of the card to get + in: path + name: cardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCardResponse_3' + description: Successful Response + summary: Get Card Limit by Id + tags: + - Get Card Limits + x-accepts: application/vnd.api+json; charset=utf-8 + /authorizations: + get: + description: 'Get List Authorizations from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_8' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/execute_200_response_1' + description: Successful Response + summary: Get List authorizations + tags: + - Get List Authorizations + x-accepts: application/vnd.api+json; charset=utf-8 + /authorizations/{authorizationId}: + get: + description: 'Get a Authorization from API ' + operationId: execute + parameters: + - description: ID of the authorization to get + in: path + name: authorizationId + required: true + schema: + type: string + - in: query + name: includeNoneAuthorized + schema: + type: boolean + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAuthorizationResponse' + description: Successful Response + summary: Get Authorization by Id + tags: + - Get Authorization + x-accepts: application/vnd.api+json; charset=utf-8 + /authorization-requests: + get: + description: 'Get List Authorization Requests from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_9' + style: deepObject + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/execute_200_response_2' + description: Successful Response + summary: Get List Authorization Requests + tags: + - Get List Authorization Requests + x-accepts: application/vnd.api+json; charset=utf-8 + /authorization-requests/{authorizationId}: + get: + description: 'Get a Authorization Request from API ' + operationId: execute + parameters: + - description: ID of the authorization request to get + in: path + name: authorizationId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAuthorizationRequestsResponse' + description: Successful Response + summary: Get Authorization Request by Id + tags: + - Get Authorization Request + x-accepts: application/vnd.api+json; charset=utf-8 + /authorization-requests/{authorizationId}/approve: + post: + description: 'Approve a Authorization Request via API ' + operationId: execute + parameters: + - description: ID of the authorization request to approve + in: path + name: authorizationId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_10' + description: Approve Authorization Request Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAuthorizationRequestResponse' + description: Successful Response + summary: Approve Authorization Request by Id + tags: + - Approve Authorization Request + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /authorization-requests/{authorizationId}/decline: + post: + description: 'Decline Authorization Request via API ' + operationId: execute + parameters: + - description: ID of the authorization request to decline + in: path + name: authorizationId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_11' + description: Decline Authorization Request Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitAuthorizationRequestResponse' + description: Successful Response + summary: Decline Authorization Request + tags: + - Decline Authorization Request + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /statements: + get: + description: 'Get List Statements from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_10' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitStatementsResponse' + description: Successful Response + summary: Get List Statements + tags: + - Get List Statements + x-accepts: application/vnd.api+json; charset=utf-8 + /statements/{statementId}/html: + get: + description: 'Get a HTML Statement from API ' + operationId: execute + parameters: + - description: ID of the statement to get + in: path + name: statementId + required: true + schema: + type: string + responses: + "200": + content: + text/html: + schema: + type: string + description: Successful Response + summary: Get HTML Statement by Id + tags: + - Get Statement HTML + x-accepts: text/html + /statements/{statementId}/pdf: + get: + description: 'Get a PDF Statement from API ' + operationId: execute + parameters: + - description: ID of the statement to get + in: path + name: statementId + required: true + schema: + type: string + responses: + "200": + content: + application/pdf: + schema: + format: binary + type: string + description: Successful Response + summary: Get PDF Statement by Id + tags: + - Get Statement PDF + x-accepts: application/pdf + /statements/{accountId}/bank/pdf: + get: + description: 'Get Get Bank verification PDF from API ' + operationId: execute + parameters: + - description: ID of the account to get + in: path + name: accountId + required: true + schema: + type: string + responses: + "200": + content: + application/pdf: + schema: + format: binary + type: string + description: Successful Response + summary: Get Bank verification PDF + tags: + - Get Bank verification PDF + x-accepts: application/pdf + /rewards: + get: + description: 'Get Rewards List from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_11' + style: deepObject + - in: query + name: sort + schema: + type: string + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRewardsListResponse' + description: Successful Response + summary: Get Rewards List + tags: + - Get List Rewards + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a Reward via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_12' + description: Create Reward Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitRewardResponse' + description: Successful Response + summary: Create Reward + tags: + - Create Reward + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /rewards/{rewardId}: + get: + description: 'Get a Reward from API ' + operationId: execute + parameters: + - description: ID of the reward to get + in: path + name: rewardId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRewardResponse' + description: Successful Response + summary: Get Reward by Id + tags: + - Get Reward + x-accepts: application/vnd.api+json; charset=utf-8 + /events: + get: + description: 'Get Events List from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_12' + style: deepObject + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitEventListResponse' + description: Successful Response + summary: Get Events List + tags: + - Get List Events + x-accepts: application/vnd.api+json; charset=utf-8 + /events/{eventId}: + get: + description: 'Get an Event from API ' + operationId: execute + parameters: + - description: ID of the event to get + in: path + name: eventId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitEventResponse_1' + description: Successful Response + summary: Get Event by Id + tags: + - Get Event + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Fire an Event via API ' + operationId: execute + parameters: + - description: ID of the event to fire + in: path + name: eventId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitEventResponse' + description: Successful Response + summary: Fire Event by Id + tags: + - Fire Event + x-accepts: application/vnd.api+json; charset=utf-8 + /institutions/{routingNumber}: + get: + description: 'Get an Institution from API ' + operationId: execute + parameters: + - description: routingNumber of the institution to get + in: path + name: routingNumber + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitInstitutionResponse' + description: Successful Response + summary: Get Institution by Routing Number + tags: + - Get Institution + x-accepts: application/vnd.api+json; charset=utf-8 + /fees: + post: + description: 'Create a Fee via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_13' + description: Create Fee Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitFeeResponse' + description: Successful Response + summary: Create Fee + tags: + - Create Fee + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /check-deposits: + get: + description: 'Get List Check Deposits from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_13' + style: deepObject + - in: query + name: sort + schema: + type: string + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + items: + $ref: '#/components/schemas/check_deposit' + type: array + description: Successful Response + summary: Get List Check Deposits + tags: + - Get List Check Deposits + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a Check Deposit via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_14' + description: Create Check Deposit Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCheckDepositResponse' + description: Successful Response + summary: Create Check Deposit + tags: + - Create Check Deposit + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /check-deposits/{checkDepositId}: + get: + description: 'Get a Check Deposit from API ' + operationId: execute + parameters: + - description: ID of the check deposit to get + in: path + name: checkDepositId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckDepositResponse' + description: Successful Response + summary: Get Check Deposit by Id + tags: + - Get Check Deposit + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update a Check Deposit via API ' + operationId: execute + parameters: + - description: ID of the check deposit to update + in: path + name: checkDepositId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_check_deposit' + description: Update Check Deposit Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCheckDepositResponse' + description: Successful Response + summary: Update Check Deposit + tags: + - Update Check Deposit + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /check-deposits/{checkDepositId}/confirm: + post: + description: 'Confirm a Check Deposit from API ' + operationId: execute + parameters: + - description: ID of the check deposit to confirm + in: path + name: checkDepositId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckDepositResponse' + description: Successful Response + summary: Confirm by Id + tags: + - Confirm Check Deposit + x-accepts: application/vnd.api+json; charset=utf-8 + /check-deposits/{checkDepositId}/front: + get: + description: 'Get Front Check Deposit Image from API ' + operationId: execute + parameters: + - description: ID of the check deposit to get + in: path + name: checkDepositId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckDepositResponse_1' + description: Successful Response + summary: Get Front Check Deposit Image by Id + tags: + - Get Check Deposit Front Image + x-accepts: application/vnd.api+json; charset=utf-8 + /check-deposits/{checkDepositId}/back: + get: + description: 'Get Back Check Deposit Image from API ' + operationId: execute + parameters: + - description: ID of the check deposit to get + in: path + name: checkDepositId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckDepositResponse_1' + description: Successful Response + summary: Get Back Check Deposit Image by Id + tags: + - Get Check Deposit Back Image + x-accepts: application/vnd.api+json; charset=utf-8 + /users/{userId}/api-tokens: + get: + description: 'Get List Org API Tokens from API ' + operationId: execute + parameters: + - description: ID of the user to revoke token + in: path + name: userId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitOrgApiTokensListResponse' + description: Successful Response + summary: Get List Org API Tokens + tags: + - Get List Org API Tokens + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create an Org API Token via API ' + operationId: execute + parameters: + - description: ID of the user to create token for + in: path + name: userId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_15' + description: Create Org API Token Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitApiTokenResponse' + description: Successful Response + summary: Create Org API Token + tags: + - Create Org Api Token + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /users/{userId}/api-tokens/{tokenId}: + delete: + description: 'Get a Reward from API ' + operationId: execute + parameters: + - description: ID of the user to revoke token + in: path + name: userId + required: true + schema: + type: string + - description: ID of the token to revoke + in: path + name: tokenId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitApiTokenResponse' + description: Successful Response + summary: Get Reward by Id + tags: + - Revoke Org API Token + x-accepts: application/vnd.api+json; charset=utf-8 + /customers/{customerId}/token: + post: + description: 'Create a Customer Token via API ' + operationId: execute + parameters: + - description: ID of the customer to create token for + in: path + name: customerId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_16' + description: Create Customer Token Request + required: true + responses: + "201": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCustomerTokenResponse' + description: Successful Response + summary: Create Customer Token + tags: + - Create Customer Token + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /customers/{customerId}/token/verification: + post: + description: 'Create a Customer Token Verification via API ' + operationId: execute + parameters: + - description: ID of the customer to create token for + in: path + name: customerId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_17' + description: Create Customer Token Verification Request + required: true + responses: + "201": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCustomerTokenVerificationResponse' + description: Successful Response + summary: Create Customer Token Verification + tags: + - Create Customer Token Verification + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /webhooks: + get: + description: 'Get List Webhooks from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_14' + style: deepObject + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitWebhooksListResponse' + description: Successful Response + summary: Get List Webhooks + tags: + - Get List Webhooks + x-accepts: application/vnd.api+json + post: + description: 'Create a Webhook via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/createWebhook' + description: Create Webhook Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitWebhookResponse' + description: Successful Response + summary: Create Webhook + tags: + - Create Webhook + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /webhooks/{webhookId}: + get: + description: 'Get a Webhook from API ' + operationId: execute + parameters: + - description: ID of the webhook to get + in: path + name: webhookId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitWebhookResponse' + description: Successful Response + summary: Get Webhook Id + tags: + - Get Webhook + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update a Webhook via API ' + operationId: execute + parameters: + - description: ID of the Webhook to update + in: path + name: webhookId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/updateUnitRequest' + description: Update Webhook Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitWebhookResponse' + description: Successful Response + summary: Update Webhook + tags: + - Update Webhook + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /webhooks/{webhookId}/enable: + post: + description: 'Enable a Webhook via API ' + operationId: execute + parameters: + - description: ID of the webhook to enable + in: path + name: webhookId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitWebhookResponse' + description: Successful Response + summary: Enable Webhook + tags: + - Enable Webhook + x-accepts: application/vnd.api+json; charset=utf-8 + /webhooks/{webhookId}/disable: + post: + description: 'Disable a Webhook via API ' + operationId: execute + parameters: + - description: ID of the webhook to disable + in: path + name: webhookId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitWebhookResponse' + description: Successful Response + summary: Disable a Webhook + tags: + - Disable Webhook + x-accepts: application/vnd.api+json; charset=utf-8 + /atm-locations: + get: + description: 'Get List ATM Locations from API ' + operationId: execute + parameters: + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_15' + style: deepObject + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + items: + type: object + title: UnitAtmLocationsListResponse + type: array + description: Successful Response + summary: Get List ATM Locations + tags: + - Get ATM Locations List + x-accepts: application/vnd.api+json; charset=utf-8 + /accounts/{accountId}/transactions/{transactionId}: + get: + description: 'Get a Transaction from API ' + operationId: execute + parameters: + - description: ID of the account to get transaction from + in: path + name: accountId + required: true + schema: + type: string + - description: ID of the transaction + in: path + name: transactionId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitTransactionResponse' + description: Successful Response + summary: Get Transaction by Id + tags: + - Get Transaction + x-accepts: application/vnd.api+json; charset=utf-8 + patch: + description: 'Update a Transaction via API ' + operationId: execute + parameters: + - description: ID of the account to update transaction from + in: path + name: accountId + required: true + schema: + type: string + - description: ID of the transaction to update + in: path + name: transactionId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/update_transaction' + description: Update Transaction Request + required: true + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitTransactionResponse_1' + description: Successful Response + summary: Update Transaction + tags: + - Update Transaction + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /transactions: + get: + description: 'Get List Transactions from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_16' + style: deepObject + - in: query + name: sort + schema: + type: string + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitTransactionsListResponse' + description: Successful Response + summary: Get List Transactions + tags: + - Get List Transactions + x-accepts: application/vnd.api+json + /disputes: + get: + description: 'Get List Disputes from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_17' + style: deepObject + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + items: + $ref: '#/components/schemas/dispute' + title: UnitDisputesListResponse + type: array + description: Successful Response + summary: Get List Disputes + tags: + - Get List Disputes + x-accepts: application/vnd.api+json; charset=utf-8 + /disputes/{disputeId}: + get: + description: 'Get a Dispute from API ' + operationId: execute + parameters: + - description: ID of the dispute to get + in: path + name: disputeId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitDisputeResponse' + description: Successful Response + summary: Get Dispute by Id + tags: + - Get Dispute + x-accepts: application/vnd.api+json; charset=utf-8 + /repayments: + get: + description: 'Get List Repayments from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - allowReserved: true + in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_18' + style: deepObject + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRepaymentsListResponse' + description: Successful Response + "401": {} + summary: Get List Repayments + tags: + - Get List Repayments + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create a Repayment via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_18' + description: Create a Repayment Request + required: true + responses: + "201": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRepaymentResponse' + description: Successful Response + default: {} + summary: Create a Repayment + tags: + - Create a Repayment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /repayments/{repaymentId}: + get: + description: 'Get an Repayment from API ' + operationId: execute + parameters: + - description: ID of the repayment to get + in: path + name: repaymentId + required: true + schema: + type: string + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitRepaymentResponse' + description: Successful Response + summary: Get Repayment by Id + tags: + - Get Repayment + x-accepts: application/vnd.api+json; charset=utf-8 + /check-payments: + get: + description: 'Get List Check Payments from API ' + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_19' + - in: query + name: sort + schema: + type: string + - in: query + name: include + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/execute_200_response_3' + description: Successful Response + summary: Get List Check Payments + tags: + - Get List Check Payments + x-accepts: application/vnd.api+json; charset=utf-8 + post: + description: 'Create Check Payment via API ' + operationId: execute + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_19' + description: Create Check Payment Request + required: true + responses: + "201": + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/UnitCheckPaymentResponse' + description: Successful Response + summary: Create Check Payment + tags: + - Create Check Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json + /check-payments/{checkPaymentId}: + get: + description: 'Get a Check Payment from API ' + operationId: execute + parameters: + - description: ID of the check payment to get + in: path + name: checkPaymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckPaymentResponse' + description: Successful Response + summary: Get Check Payment by Id + tags: + - Get Check Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /check-payments/{checkPaymentId}/approve: + post: + description: 'Approve a Check Payment via API ' + operationId: execute + parameters: + - description: ID of the check payment to approve + in: path + name: checkPaymentId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_20' + description: Approve Check Payment Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckPaymentResponse' + description: Successful Response + summary: Approve Check Payment by Id + tags: + - Approve Check Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /check-payments/{checkPaymentId}/cancel: + post: + description: 'Cancel a Check Payment via API ' + operationId: execute + parameters: + - description: ID of the check payment to cancel + in: path + name: checkPaymentId + required: true + schema: + type: string + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckPaymentResponse' + description: Successful Response + summary: Cancel Check Payment by Id + tags: + - Cancel Check Payment + x-accepts: application/vnd.api+json; charset=utf-8 + /check-payments/{checkPaymentId}/return: + post: + description: 'Return a Check Payment via API ' + operationId: execute + parameters: + - description: ID of the check payment to return + in: path + name: checkPaymentId + required: true + schema: + type: string + requestBody: + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/execute_request_21' + description: Return Check Payment Request + required: true + responses: + "200": + content: + application/vnd.api+json; charset=utf-8: + schema: + $ref: '#/components/schemas/UnitCheckPaymentResponse' + description: Successful Response + summary: Return Check Payment by Id + tags: + - Return Check Payment + x-content-type: application/vnd.api+json + x-accepts: application/vnd.api+json; charset=utf-8 + /check-payments/{checkPaymentId}/front: + get: + description: 'Get front image via API ' + operationId: execute + parameters: + - description: ID of the check payment + in: path + name: checkPaymentId + required: true + schema: + type: string + responses: + "200": + content: + image/png: + schema: + format: binary + type: string + description: Successful Response + summary: Get front image + tags: + - Get a front image + x-accepts: image/png + /check-payments/{checkPaymentId}/back: + get: + description: 'Get back image via API ' + operationId: execute + parameters: + - description: ID of the check payment + in: path + name: checkPaymentId + required: true + schema: + type: string + responses: + "200": + content: + image/png: + schema: + format: binary + type: string + description: Successful Response + summary: Get back image + tags: + - Get a back image + x-accepts: image/png + /stop-payments: + get: + operationId: execute + parameters: + - in: query + name: page + schema: + $ref: '#/components/schemas/listPageParametersObject' + - in: query + name: filter + schema: + $ref: '#/components/schemas/execute_filter_parameter_20' + - in: query + name: sort + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StopPaymentListResponse' + description: OK + summary: Get a list of stop payments + x-accepts: application/json + post: + operationId: execute + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/createStopPayment' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StopPaymentResponse' + description: OK + summary: Create a new stop payment + x-content-type: application/json + x-accepts: application/json + /stop-payments/{stop_payment_id}: + delete: + operationId: execute + parameters: + - description: ID of the stop payment + in: path + name: stop_payment_id + required: true + schema: + type: string + responses: + "204": + description: Stop payment successfully canceled + "404": + description: Stop payment not found + summary: Cancel a stop payment + x-accepts: application/json + get: + operationId: execute + parameters: + - description: ID of the stop payment + in: path + name: stop_payment_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StopPaymentResponse' + description: OK + "404": + description: Stop payment not found + summary: Get details of a specific stop payment + x-accepts: application/json + /stop-payments/{stop_payment_id}/disable: + post: + operationId: execute + parameters: + - description: ID of the stop payment + in: path + name: stop_payment_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StopPaymentResponse' + description: OK + "404": + description: Stop payment not found + summary: Disable a stop payment + x-accepts: application/json +components: + responses: + unitError: {} + schemas: + UnitApplicationResponseWithIncluded: + properties: + data: + $ref: '#/components/schemas/application' + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + title: UnitApplicationResponseWithIncluded + type: object + update_application: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/update_application_data' + required: + - data + title: Patch Application + type: object + patchBusinessApplication: + additionalProperties: false + properties: + type: + default: businessApplication + type: string + attributes: + $ref: '#/components/schemas/patchBusinessApplication_attributes' + required: + - attributes + - type + title: Patch Business Application + type: object + officer: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + title: Officer + type: object + beneficialOwner: + additionalProperties: false + properties: + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + title: Beneficial Owner + type: object + patchIndividualApplication: + additionalProperties: false + properties: + type: + default: individualApplication + type: string + attributes: + $ref: '#/components/schemas/patchIndividualApplication_attributes' + required: + - attributes + - type + title: Patch Individual Application + type: object + patchTrustApplication: + additionalProperties: false + properties: + type: + default: trustApplication + type: string + attributes: + $ref: '#/components/schemas/patchTrustApplication_attributes' + required: + - attributes + - type + title: Patch Trust Application + type: object + application: + discriminator: + mapping: + individualApplication: '#/components/schemas/IndividualApplication' + businessApplication: '#/components/schemas/BusinessApplication' + trustApplication: '#/components/schemas/TrustApplication' + propertyName: type + example: + id: id + type: type + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + type: string + title: Application + type: object + IndividualApplication: + allOf: + - $ref: '#/components/schemas/application' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/IndividualApplication_allOf_attributes' + relationships: + $ref: '#/components/schemas/applicationRelationships' + required: + - attributes + - id + - type + type: object + title: IndividualApplication + type: object + powerOfAttorneyAgent: + additionalProperties: false + properties: + status: + type: string + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + type: object + dateOfBirth: + format: date + type: string + evaluationId: + type: string + evaluationFlags: + items: + type: string + type: array + maskedSSN: + pattern: "^\\*{5}\\d{4}$" + type: string + maskedPassport: + type: string + maskedMatriculaConsular: + type: string + idTheftScore: + type: integer + required: + - fullName + - status + title: PowerOfAttorneyAgent + type: object + applicationRelationships: + additionalProperties: false + properties: + org: + $ref: '#/components/schemas/orgRelationship' + customer: + $ref: '#/components/schemas/Relationship' + documents: + $ref: '#/components/schemas/documentsRelationship' + applicationForm: + $ref: '#/components/schemas/Relationship' + trustees: + $ref: '#/components/schemas/applicationRelationships_trustees' + beneficiaries: + $ref: '#/components/schemas/applicationRelationships_beneficiaries' + beneficialOwners: + $ref: '#/components/schemas/applicationRelationships_beneficialOwners' + title: applicationRelationships + type: object + BusinessApplication: + allOf: + - $ref: '#/components/schemas/application' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BusinessApplication_allOf_attributes' + relationships: + $ref: '#/components/schemas/applicationRelationships' + required: + - attributes + - id + - type + type: object + title: BusinessApplication + type: object + officer_1: + properties: + status: + type: string + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + type: object + dateOfBirth: + format: date + type: string + evaluationId: + type: string + title: + enum: + - President + - CEO + - COO + - CFO + - BenefitsAdministrationOfficer + - CIO + - VP + - AVP + - Treasurer + - Secretary + - Controller + - Manager + - Partner + - Member + type: string + evaluationFlags: + items: + type: string + type: array + maskedSSN: + pattern: "^\\*{5}\\d{4}$" + type: string + maskedPassport: + type: string + maskedMatriculaConsular: + type: string + idTheftScore: + type: integer + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + title: Officer + type: object + beneficialOwner_1: + properties: + status: + type: string + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + type: object + dateOfBirth: + format: date + type: string + evaluationId: + type: string + percentage: + maximum: 100 + minimum: 0 + type: integer + evaluationFlags: + items: + type: string + type: array + maskedSSN: + pattern: "^\\*{5}\\d{4}$" + type: string + maskedPassport: + type: string + maskedMatriculaConsular: + type: string + idTheftScore: + type: integer + evaluationCodes: + items: + type: string + type: array + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + title: Beneficial Owner + type: object + TrustApplication: + allOf: + - $ref: '#/components/schemas/application' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/TrustApplication_allOf_attributes' + relationships: + $ref: '#/components/schemas/applicationRelationships' + required: + - attributes + - id + - type + type: object + title: TrustApplication + type: object + document: + additionalProperties: false + properties: + type: + default: document + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/document_attributes' + required: + - attributes + - id + - type + title: Application Document Document + type: object + listPageParametersObject: + properties: + limit: + default: 100 + maximum: 1000 + type: integer + offset: + default: 0 + type: integer + type: object + paginationMeta: + example: + pagination: + total: 1 + offset: 6 + limit: 0 + properties: + pagination: + $ref: '#/components/schemas/paginationMeta_pagination' + type: object + UnitError: + title: UnitError + type: object + createApplication: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/createApplication_data' + required: + - data + type: object + CreateIndividualApplication: + additionalProperties: false + properties: + type: + default: individualApplication + type: string + attributes: + $ref: '#/components/schemas/CreateIndividualApplication_attributes' + required: + - attributes + - type + title: Create Individual Application + type: object + createPowerOfAttorneyAgent: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + jwtSubject: + nullable: true + type: string + evaluationParams: + $ref: '#/components/schemas/evaluationParams' + required: + - address + - dateOfBirth + - email + - fullName + - phone + title: CreatePowerOfAttorneyAgent + type: object + evaluationParams: + additionalProperties: false + properties: + useSelfieVerification: + enum: + - Never + - ReplaceIdentification + - Always + type: string + requireIdVerification: + default: false + type: boolean + title: EvaluationParams + type: object + CreateSoleProprietorApplication: + additionalProperties: false + properties: + type: + default: individualApplication + type: string + attributes: + $ref: '#/components/schemas/CreateSoleProprietorApplication_attributes' + required: + - attributes + - type + title: Create Sole Proprietor Application + type: object + CreateBusinessApplication: + additionalProperties: false + properties: + type: + default: businessApplication + type: string + attributes: + $ref: '#/components/schemas/CreateBusinessApplication_attributes' + required: + - attributes + - type + title: Create Business Application + type: object + createOfficer: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + title: + enum: + - President + - CEO + - COO + - CFO + - BenefitsAdministrationOfficer + - CIO + - VP + - AVP + - Treasurer + - Secretary + - Controller + - Manager + - Partner + - Member + type: string + evaluationParams: + $ref: '#/components/schemas/evaluationParams' + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + required: + - address + - dateOfBirth + - email + - fullName + - occupation + - phone + title: CreateOfficer + type: object + createBeneficialOwner: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + percentage: + maximum: 100 + minimum: 0 + type: integer + evaluationParams: + $ref: '#/components/schemas/evaluationParams' + required: + - address + - dateOfBirth + - email + - fullName + - phone + title: CreateBeneficialOwner + type: object + CreateTrustApplication: + additionalProperties: false + properties: + type: + default: trustApplication + type: string + attributes: + $ref: '#/components/schemas/CreateTrustApplication_attributes' + required: + - attributes + - type + title: Create Trust Application + type: object + application_form: + additionalProperties: false + properties: + type: + default: applicationForm + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/application_form_attributes' + relationships: + $ref: '#/components/schemas/applicationFormRelationships' + officerIsBeneficialOwner: + default: false + type: boolean + required: + - attributes + - id + - type + title: Application Form + type: object + applicationFormRelationships: + additionalProperties: false + properties: + application: + $ref: '#/components/schemas/applicationFormRelationships_application' + title: applicationFormRelationships + type: object + createApplicationForm: + additionalProperties: false + properties: + type: + default: applicationForm + type: string + attributes: + $ref: '#/components/schemas/createApplicationForm_attributes' + relationships: + $ref: '#/components/schemas/createApplicationFormRelationships' + required: + - type + title: Create Application Form + type: object + prefilled: + additionalProperties: false + properties: + applicationType: + enum: + - Individual + - Business + - SoleProprietorship + type: string + fullName: + $ref: '#/components/schemas/fullName' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + dateOfBirth: + format: date + type: string + email: + format: email + type: string + name: + maxLength: 255 + minLength: 1 + type: string + stateOfIncorporation: + maxLength: 2 + minLength: 2 + type: string + entityType: + $ref: '#/components/schemas/entityType' + contact: + $ref: '#/components/schemas/contact' + officer: + $ref: '#/components/schemas/createOfficer' + beneficialOwners: + items: + $ref: '#/components/schemas/createBeneficialOwner' + type: array + website: + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + dba: + maxLength: 255 + minLength: 1 + type: string + ein: + pattern: "^\\d{9}$" + type: string + jwtSubject: + nullable: true + type: string + industry: + $ref: '#/components/schemas/industry' + title: Application Form Prefilled + type: object + settingsOverride: + additionalProperties: false + properties: + redirectUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + privacyPolicyUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + electronicDisclosuresUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + depositTermsUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + clientTermsUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + cardholderTermsUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + cashAdvancedTermsUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + debitCardDisclosureUrl: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + additionalDisclosures: + items: + $ref: '#/components/schemas/applicationFormAdditionalDisclosures_inner' + type: array + validatePhoneNumber: + default: true + type: boolean + type: object + requireIdVerification: + additionalProperties: false + properties: + individual: + default: false + type: boolean + officer: + default: false + type: boolean + beneficialOwners: + default: false + type: boolean + type: object + UnitDocumentResponse: + properties: + data: + $ref: '#/components/schemas/document' + title: UnitDocumentResponse + type: object + UnitAccountResponse: + properties: + data: + $ref: '#/components/schemas/account' + title: UnitAccountResponse + type: object + account: + discriminator: + mapping: + depositAccount: '#/components/schemas/DepositAccount' + creditAccount: '#/components/schemas/CreditAccount' + propertyName: type + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + type: string + title: Account Document + type: object + DepositAccount: + allOf: + - $ref: '#/components/schemas/account' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/DepositAccount_allOf_attributes' + relationships: + $ref: '#/components/schemas/depositAccountRelationships' + required: + - attributes + - relationships + type: object + title: Deposit Account + type: object + CreditAccount: + allOf: + - $ref: '#/components/schemas/account' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CreditAccount_allOf_attributes' + relationships: + $ref: '#/components/schemas/creditAccountRelationships' + required: + - attributes + - relationships + type: object + title: Credit Account + type: object + customer: + discriminator: + mapping: + individualCustomer: '#/components/schemas/IndividualCustomer' + businessCustomer: '#/components/schemas/BusinessCustomer' + trustCustomer: '#/components/schemas/TrustCustomer' + propertyName: type + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + type: string + title: Customer + type: object + IndividualCustomer: + allOf: + - $ref: '#/components/schemas/customer' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/IndividualCustomer_allOf_attributes' + relationships: + $ref: '#/components/schemas/customerRelationships' + type: object + title: IndividualCustomer + type: object + customerRelationships: + additionalProperties: false + properties: + org: + $ref: '#/components/schemas/orgRelationship' + application: + $ref: '#/components/schemas/Relationship' + title: customerRelationships + type: object + BusinessCustomer: + additionalProperties: false + allOf: + - $ref: '#/components/schemas/customer' + - properties: + attributes: + $ref: '#/components/schemas/BusinessCustomer_allOf_attributes' + relationships: + $ref: '#/components/schemas/customerRelationships' + type: object + title: BusinessCustomer + type: object + TrustCustomer: + allOf: + - $ref: '#/components/schemas/customer' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/TrustCustomer_allOf_attributes' + relationships: + $ref: '#/components/schemas/customerRelationships' + type: object + title: TrustCustomer + type: object + createAccount: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/createAccount_data' + required: + - data + title: Create Account + type: object + CreateCreditAccount: + properties: + type: + default: creditAccount + enum: + - creditAccount + - depositAccount + type: string + attributes: + $ref: '#/components/schemas/CreateCreditAccount_attributes' + relationships: + $ref: '#/components/schemas/CreateCreditAccount_relationships' + title: Create Credit Account + type: object + CreateDepositAccount: + additionalProperties: false + properties: + type: + default: depositAccount + enum: + - depositAccount + type: string + attributes: + $ref: '#/components/schemas/CreateDepositAccount_attributes' + relationships: + $ref: '#/components/schemas/CreateDepositAccount_relationships' + title: Create Deposit Account + type: object + UnitAccountResponseWithIncluded: + properties: + data: + $ref: '#/components/schemas/account' + included: + items: + $ref: '#/components/schemas/customer' + type: array + title: UnitAccountResponseWithIncluded + type: object + patch_account: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/patch_account_data' + required: + - data + title: Update Account + type: object + updateDepositAccount: + additionalProperties: false + properties: + type: + default: depositAccount + type: string + attributes: + $ref: '#/components/schemas/updateDepositAccount_attributes' + required: + - attributes + - type + title: Update Deposit Account + type: object + updateCreditAccount: + additionalProperties: false + properties: + type: + default: creditAccount + type: string + attributes: + $ref: '#/components/schemas/updateCreditAccount_attributes' + required: + - attributes + - type + title: Update Credit Account + type: object + limits: + properties: + type: + type: string + id: + type: string + attributes: + $ref: '#/components/schemas/limits_attributes' + type: object + freezeAccountRequest: + properties: + type: + enum: + - creditAccountFreeze + - accountFreeze + type: string + attributes: + $ref: '#/components/schemas/freezeAccountRequest_attributes' + type: object + closeAccountRequest: + properties: + type: + enum: + - creditAccountClose + - depositAccountClose + type: string + attributes: + $ref: '#/components/schemas/closeAccountRequest_attributes' + type: object + account_end_of_day: + additionalProperties: false + properties: + type: + enum: + - accountEndOfDay + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/account_end_of_day_attributes' + relationships: + $ref: '#/components/schemas/relationships' + required: + - attributes + - id + - relationships + - type + title: Account End Of Day Resource + type: object + relationships: + additionalProperties: false + properties: + customer: + $ref: '#/components/schemas/relationships_customer' + account: + $ref: '#/components/schemas/relationships_account' + required: + - account + type: object + UnitCustomerResponse: + properties: + data: + $ref: '#/components/schemas/customer' + title: UnitCustomerResponse + type: object + update_customer: + properties: + data: + $ref: '#/components/schemas/update_customer_data' + title: Patch Customer + type: object + updateIndividualCustomer: + additionalProperties: false + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/updateIndividualCustomer_attributes' + title: UpdateIndividualCustomer + type: object + updateBusinessCustomer: + additionalProperties: false + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/updateBusinessCustomer_attributes' + title: UpdateBusinessCustomer + type: object + updateTrustCustomer: + additionalProperties: false + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/updateTrustCustomer_attributes' + title: UpdateTrustCustomer + type: object + UnitPaymentResponse: + properties: + data: + $ref: '#/components/schemas/payment' + title: UnitPaymentResponse + type: object + payment: + discriminator: + mapping: + achPayment: '#/components/schemas/AchPayment' + bookPayment: '#/components/schemas/BookPayment' + wirePayment: '#/components/schemas/WirePayment' + billPayment: '#/components/schemas/BillPayment' + propertyName: type + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + title: Payment Resource + type: object + AchPayment: + allOf: + - $ref: '#/components/schemas/payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/AchPayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/paymentRelationships' + required: + - attributes + - id + - relationships + - type + type: object + title: ACH Payment + type: object + counterparty: + additionalProperties: false + properties: + routingNumber: + pattern: "^\\d{9}$" + type: string + accountNumber: + pattern: "^\\d{1,17}$" + type: string + accountType: + enum: + - Checking + - Savings + - Loan + type: string + name: + maxLength: 50 + minLength: 1 + type: string + required: + - accountNumber + - accountType + - name + - routingNumber + title: Counterparty + type: object + paymentRelationships: + additionalProperties: true + properties: + account: + $ref: '#/components/schemas/Relationship' + customer: + $ref: '#/components/schemas/Relationship' + customers: + $ref: '#/components/schemas/paymentRelationships_customers' + counterparty: + $ref: '#/components/schemas/Relationship' + counterpartyAccount: + $ref: '#/components/schemas/Relationship' + transaction: + $ref: '#/components/schemas/Relationship' + recurringPayment: + $ref: '#/components/schemas/Relationship' + type: object + BookPayment: + allOf: + - $ref: '#/components/schemas/payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BookPayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/paymentRelationships' + required: + - attributes + - id + - relationships + - type + type: object + title: Book Payment + type: object + WirePayment: + allOf: + - $ref: '#/components/schemas/payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/WirePayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/paymentRelationships' + required: + - attributes + - id + - relationships + - type + type: object + title: Wire Payment + type: object + BillPayment: + allOf: + - $ref: '#/components/schemas/payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BillPayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/paymentRelationships' + required: + - attributes + - id + - relationships + - type + type: object + title: Bill Payment + type: object + IncludedResource: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + createPayment: + oneOf: + - $ref: '#/components/schemas/CreateAchPayment' + - $ref: '#/components/schemas/CreateAchPaymentCounterparty' + - $ref: '#/components/schemas/CreateAchPaymentPlaid' + - $ref: '#/components/schemas/CreateBookPayment' + - $ref: '#/components/schemas/CreateWirePayment' + - $ref: '#/components/schemas/CreateBillPayment' + - $ref: '#/components/schemas/CreatePushToCardPayment' + title: Create Payment + type: object + CreateAchPayment: + additionalProperties: false + properties: + type: + default: achPayment + type: string + attributes: + $ref: '#/components/schemas/CreateAchPayment_attributes' + relationships: + $ref: '#/components/schemas/CreateAchPayment_relationships' + required: + - attributes + - relationships + title: Create ACH Payment + type: object + accountRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/accountRelationship_data' + required: + - data + type: object + CreateAchPaymentCounterparty: + additionalProperties: false + properties: + type: + default: achPayment + type: string + attributes: + $ref: '#/components/schemas/CreateAchPaymentCounterparty_attributes' + relationships: + $ref: '#/components/schemas/CreateAchPaymentCounterparty_relationships' + required: + - attributes + - relationships + title: Create ACH Payment + type: object + counterpartyRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/counterpartyRelationship_data' + required: + - data + type: object + CreateAchPaymentPlaid: + additionalProperties: false + properties: + type: + default: achPayment + type: string + attributes: + $ref: '#/components/schemas/CreateAchPaymentPlaid_attributes' + relationships: + $ref: '#/components/schemas/CreateAchPayment_relationships' + required: + - attributes + - relationships + title: Create ACH Payment + type: object + CreateBookPayment: + additionalProperties: false + properties: + type: + default: bookPayment + type: string + attributes: + $ref: '#/components/schemas/CreateBookPayment_attributes' + relationships: + $ref: '#/components/schemas/CreateBookPayment_relationships' + required: + - attributes + - relationships + title: Create Book Payment + type: object + counterpartyAccountRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/counterpartyAccountRelationship_data' + required: + - data + type: object + CreateWirePayment: + additionalProperties: false + properties: + type: + default: wirePayment + type: string + attributes: + $ref: '#/components/schemas/CreateWirePayment_attributes' + relationships: + $ref: '#/components/schemas/CreateAchPayment_relationships' + required: + - attributes + - relationships + title: Create Wire Payment + type: object + CreateBillPayment: + additionalProperties: false + properties: + type: + default: billPayment + type: string + attributes: + $ref: '#/components/schemas/CreateBillPayment_attributes' + relationships: + $ref: '#/components/schemas/CreateAchPayment_relationships' + required: + - attributes + - relationships + title: Create Bill Payment + type: object + CreatePushToCardPayment: + additionalProperties: false + properties: + type: + default: pushToCardPayment + type: string + attributes: + $ref: '#/components/schemas/CreatePushToCardPayment_attributes' + relationships: + $ref: '#/components/schemas/CreateAchPayment_relationships' + required: + - attributes + - relationships + title: Create Push To Card Payment + type: object + update_payment: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/update_payment_data' + required: + - data + title: Patch Payment + type: object + patchAchPayment: + additionalProperties: false + properties: + type: + default: achPayment + type: string + attributes: + $ref: '#/components/schemas/patchTrustApplication_attributes' + required: + - attributes + - type + title: Patch ACH Payment + type: object + patchBookPayment: + additionalProperties: false + properties: + type: + default: bookPayment + type: string + attributes: + $ref: '#/components/schemas/patchTrustApplication_attributes' + required: + - attributes + - type + title: Patch Book Payment + type: object + received_payment: + additionalProperties: false + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/received_payment_attributes' + relationships: + $ref: '#/components/schemas/receivedPaymentRelationships' + title: Received Payment Resource + type: object + receivedPaymentRelationships: + additionalProperties: true + properties: + account: + $ref: '#/components/schemas/relationships_account' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + receivePaymentTransaction: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction' + paymentAdvanceTransaction: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction' + repayPaymentAdvanceTransaction: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction' + required: + - account + - customer + type: object + UnitReceivedPaymentResponse: + properties: + data: + $ref: '#/components/schemas/received_payment' + title: UnitReceivedPaymentResponse + type: object + update_received_payment: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/update_received_payment_data' + required: + - data + title: Patch Received Payment + type: object + patchAchReceivedPayment: + additionalProperties: false + properties: + type: + default: achReceivedPayment + type: string + attributes: + $ref: '#/components/schemas/patchTrustApplication_attributes' + required: + - attributes + - type + title: Patch ACH Received Payment + type: object + counterparty_1: + additionalProperties: false + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/counterparty_1_attributes' + relationships: + $ref: '#/components/schemas/counterpartyRelationships' + title: Counterparty Document + type: object + counterpartyRelationships: + additionalProperties: false + properties: + customer: + $ref: '#/components/schemas/relationships_customer' + required: + - customer + title: counterpartyRelationships + type: object + createCounterparty: + oneOf: + - $ref: '#/components/schemas/CreateAchCounterparty' + - $ref: '#/components/schemas/CreatePlaidCounterparty' + title: Create Counterparty + type: object + CreateAchCounterparty: + additionalProperties: false + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/CreateAchCounterparty_attributes' + relationships: + $ref: '#/components/schemas/createCounterpartyRelationships' + required: + - attributes + - relationships + - type + title: Create Ach Counterparty + type: object + createCounterpartyRelationships: + additionalProperties: false + properties: + customer: + $ref: '#/components/schemas/Relationship' + required: + - customer + type: object + CreatePlaidCounterparty: + additionalProperties: false + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/CreatePlaidCounterparty_attributes' + relationships: + $ref: '#/components/schemas/createCounterpartyRelationships' + required: + - attributes + - relationships + - type + title: Create Plaid Counterparty + type: object + update_counterparty: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/update_counterparty_data' + required: + - data + title: Patch Counterparty + type: object + patchCounterparty: + additionalProperties: false + properties: + type: + default: counterparty + type: string + attributes: + $ref: '#/components/schemas/patchCounterparty_attributes' + required: + - attributes + - type + title: Patch Counterparty + type: object + counterparty_balance: + additionalProperties: false + properties: + type: + default: counterpartyBalance + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/counterparty_balance_attributes' + relationships: + $ref: '#/components/schemas/counterpartyBalanceRelationships' + required: + - id + - relationships + - type + title: Counterparty Balance + type: object + counterpartyBalanceRelationships: + additionalProperties: false + properties: + counterparty: + $ref: '#/components/schemas/counterpartyBalanceRelationships_counterparty' + customer: + $ref: '#/components/schemas/relationships_customer' + required: + - counterparty + - customer + title: counterpartyBalanceRelationships + type: object + UnitRecurringPaymentResponse: + properties: + data: + $ref: '#/components/schemas/recurring_payment' + title: UnitRecurringPaymentResponse + type: object + recurring_payment: + discriminator: + mapping: + recurringCreditAchPayment: '#/components/schemas/RecurringCreditAchPayment' + recurringDebitAchPayment: '#/components/schemas/RecurringDebitAchPayment' + recurringCreditBookPayment: '#/components/schemas/RecurringCreditBookPayment' + propertyName: type + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + title: Recurring Payment Resource + type: object + RecurringCreditAchPayment: + allOf: + - $ref: '#/components/schemas/recurring_payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/RecurringCreditAchPayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/recurringAchPaymentRelationships' + required: + - attributes + - relationships + type: object + title: Recurring Credit ACH Payment + type: object + schedule: + additionalProperties: false + properties: + startTime: + format: date + type: string + endTime: + format: date + type: string + interval: + enum: + - Monthly + type: string + dayOfMonth: + maximum: 28 + minimum: -5 + type: integer + nextScheduledAction: + format: date + type: string + totalNumberOfPayments: + minimum: 1 + type: integer + required: + - interval + - nextScheduledAction + title: Schedule + type: object + recurringAchPaymentRelationships: + properties: + account: + $ref: '#/components/schemas/recurringAchPaymentRelationships_account' + counterparty: + $ref: '#/components/schemas/recurringAchPaymentRelationships_counterparty' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + org: + $ref: '#/components/schemas/recurringAchPaymentRelationships_org' + type: object + RecurringDebitAchPayment: + allOf: + - $ref: '#/components/schemas/recurring_payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/RecurringDebitAchPayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/recurringAchPaymentRelationships' + required: + - attributes + - relationships + type: object + title: Recurring Debit ACH Payment + type: object + RecurringCreditBookPayment: + allOf: + - $ref: '#/components/schemas/recurring_payment' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/RecurringCreditBookPayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/recurringBookPaymentRelationships' + required: + - attributes + - relationships + type: object + title: Recurring Credit Book Payment + type: object + recurringBookPaymentRelationships: + properties: + account: + $ref: '#/components/schemas/recurringAchPaymentRelationships_account' + counterpartyAccount: + $ref: '#/components/schemas/recurringBookPaymentRelationships_counterpartyAccount' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + org: + $ref: '#/components/schemas/recurringAchPaymentRelationships_org' + type: object + createRecurringPayment: + properties: + type: + type: string + title: Create Recurring Payment + type: object + card: + discriminator: + mapping: + businessDebitCard: '#/components/schemas/BusinessDebitCard' + individualDebitCard: '#/components/schemas/IndividualDebitCard' + businessVirtualDebitCard: '#/components/schemas/BusinessVirtualDebitCard' + individualVirtualDebitCard: '#/components/schemas/IndividualVirtualDebitCard' + businessCreditCard: '#/components/schemas/BusinessCreditCard' + businessVirtualCreditCard: '#/components/schemas/BusinessVirtualCreditCard' + propertyName: type + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + title: Card Document + type: object + BusinessDebitCard: + allOf: + - $ref: '#/components/schemas/card' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BusinessDebitCard_allOf_attributes' + relationships: + $ref: '#/components/schemas/cardRelationships' + required: + - attributes + - relationships + type: object + title: Business Debit Card + type: object + physicalCardStatus: + enum: + - Active + - Inactive + - Stolen + - Lost + - Frozen + - ClosedByCustomer + - Unknown + - SuspectedFraud + - ActiveForOnlineUse + type: string + cardRelationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/cardRelationships_account' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + required: + - account + title: cardRelationships + type: object + IndividualDebitCard: + allOf: + - $ref: '#/components/schemas/card' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/IndividualDebitCard_allOf_attributes' + relationships: + $ref: '#/components/schemas/cardRelationships' + required: + - attributes + - relationships + type: object + title: Individual Debit Card + type: object + BusinessVirtualDebitCard: + allOf: + - $ref: '#/components/schemas/card' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BusinessVirtualDebitCard_allOf_attributes' + relationships: + $ref: '#/components/schemas/cardRelationships' + required: + - attributes + - relationships + type: object + title: Business Virtual Debit Card + type: object + virtualCardStatus: + enum: + - Active + - Inactive + - Stolen + - Lost + - Frozen + - ClosedByCustomer + - Unknown + - SuspectedFraud + type: string + IndividualVirtualDebitCard: + allOf: + - $ref: '#/components/schemas/card' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/IndividualVirtualDebitCard_allOf_attributes' + relationships: + $ref: '#/components/schemas/cardRelationships' + required: + - attributes + - relationships + type: object + title: Individual Virtual Debit Card + type: object + BusinessCreditCard: + allOf: + - $ref: '#/components/schemas/card' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BusinessDebitCard_allOf_attributes' + relationships: + $ref: '#/components/schemas/cardRelationships' + required: + - attributes + - relationships + type: object + title: Business Credit Card + type: object + BusinessVirtualCreditCard: + allOf: + - $ref: '#/components/schemas/card' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BusinessVirtualDebitCard_allOf_attributes' + relationships: + $ref: '#/components/schemas/cardRelationships' + required: + - attributes + - relationships + type: object + title: Business Virtual Credit Card + type: object + createCard: + oneOf: + - $ref: '#/components/schemas/CreateIndividualDebitCard' + - $ref: '#/components/schemas/CreateBusinessDebitCard' + - $ref: '#/components/schemas/CreateBusinessCreditCard' + - $ref: '#/components/schemas/CreateIndividualVirtualDebitCard' + - $ref: '#/components/schemas/CreateBusinessVirtualDebitCard' + - $ref: '#/components/schemas/CreateBusinessVirtualCreditCard' + title: Create Card + type: object + CreateIndividualDebitCard: + additionalProperties: false + properties: + type: + default: individualDebitCard + enum: + - individualDebitCard + - businessDebitCard + - businessCreditCard + - individualVirtualDebitCard + - businessVirtualDebitCard + - businessVirtualCreditCard + type: string + attributes: + $ref: '#/components/schemas/CreateIndividualDebitCard_attributes' + relationships: + $ref: '#/components/schemas/createCardRelationships' + required: + - attributes + - relationships + - type + title: Create Individual Debit Card + type: object + BIN: + additionalProperties: false + properties: + bin: + pattern: "^\\d{9}$" + type: string + institutionId: + pattern: "^\\d{9}$" + type: string + required: + - bin + - institutionId + type: object + createCardRelationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/Relationship' + customer: + $ref: '#/components/schemas/Relationship' + defaultFundingAccount: + $ref: '#/components/schemas/Relationship' + required: + - account + title: createCardRelationships + type: object + CreateBusinessDebitCard: + additionalProperties: false + properties: + type: + default: businessDebitCard + enum: + - businessDebitCard + type: string + attributes: + $ref: '#/components/schemas/CreateBusinessDebitCard_attributes' + relationships: + $ref: '#/components/schemas/createCardRelationships' + required: + - attributes + - relationships + - type + title: Create Business Debit Card + type: object + CreateBusinessCreditCard: + additionalProperties: false + properties: + type: + default: businessCreditCard + enum: + - businessCreditCard + type: string + attributes: + $ref: '#/components/schemas/CreateBusinessDebitCard_attributes' + relationships: + $ref: '#/components/schemas/createCardRelationships' + required: + - attributes + - relationships + - type + title: Create Business Credit Card + type: object + CreateIndividualVirtualDebitCard: + additionalProperties: false + properties: + type: + default: individualVirtualDebitCard + enum: + - individualVirtualDebitCard + type: string + attributes: + $ref: '#/components/schemas/CreateIndividualVirtualDebitCard_attributes' + relationships: + $ref: '#/components/schemas/createCardRelationships' + required: + - attributes + - relationships + - type + title: Create Individual Virtual Debit Card + type: object + CreateBusinessVirtualDebitCard: + additionalProperties: false + properties: + type: + default: businessVirtualDebitCard + enum: + - businessVirtualDebitCard + type: string + attributes: + $ref: '#/components/schemas/CreateBusinessVirtualDebitCard_attributes' + relationships: + $ref: '#/components/schemas/createCardRelationships' + required: + - attributes + - relationships + - type + title: Create Business Virtual Debit Card + type: object + CreateBusinessVirtualCreditCard: + additionalProperties: false + properties: + type: + default: businessVirtualCreditCard + enum: + - businessVirtualCreditCard + type: string + attributes: + $ref: '#/components/schemas/CreateBusinessVirtualDebitCard_attributes' + relationships: + $ref: '#/components/schemas/createCardRelationships' + required: + - attributes + - relationships + - type + title: Create Business Virtual Credit Card + type: object + update_card: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/update_card_data' + required: + - data + title: Patch Card + type: object + patchIndividualDebitCard: + additionalProperties: false + properties: + type: + enum: + - individualDebitCard + - individualVirtualDebitCard + - businessDebitCard + - businessVirtualDebitCard + - businessCreditCard + - businessVirtualCreditCard + type: string + attributes: + $ref: '#/components/schemas/patchIndividualDebitCard_attributes' + required: + - attributes + - type + title: Patch Individual Debit Card + type: object + patchIndividualVirtualDebitCard: + additionalProperties: false + properties: + type: + enum: + - individualVirtualDebitCard + type: string + attributes: + $ref: '#/components/schemas/patchIndividualVirtualDebitCard_attributes' + required: + - attributes + - type + title: Patch Individual Virtual Debit Card + type: object + patchBusinessDebitCard: + additionalProperties: false + properties: + type: + enum: + - businessDebitCard + type: string + attributes: + $ref: '#/components/schemas/patchBusinessDebitCard_attributes' + required: + - attributes + - type + title: Patch Business Debit Card + type: object + patchBusinessVirtualDebitCard: + additionalProperties: false + properties: + type: + enum: + - businessVirtualDebitCard + type: string + attributes: + $ref: '#/components/schemas/patchBusinessVirtualDebitCard_attributes' + required: + - attributes + - type + title: Patch Business Virtual Debit Card + type: object + patchBusinessCreditCard: + additionalProperties: false + properties: + type: + enum: + - businessCreditCard + type: string + attributes: + $ref: '#/components/schemas/patchBusinessDebitCard_attributes' + required: + - attributes + - type + title: Patch Business Credit Card + type: object + patchBusinessVirtualCreditCard: + additionalProperties: false + properties: + type: + enum: + - businessVirtualCreditCard + type: string + attributes: + $ref: '#/components/schemas/patchBusinessVirtualDebitCard_attributes' + required: + - attributes + - type + title: Patch Business Virtual Credit Card + type: object + pinStatus: + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/pinStatus_attributes' + title: PinStatusDTO + type: object + limits_1: + discriminator: + mapping: + limits: '#/components/schemas/DepositLimits' + creditLimits: '#/components/schemas/CreditLimits' + propertyName: type + properties: + type: + type: string + title: Account Limits Resource + type: object + DepositLimits: + allOf: + - $ref: '#/components/schemas/limits_1' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/DepositLimits_allOf_attributes' + required: + - attributes + type: object + title: Deposit Account Limits + type: object + CreditLimits: + allOf: + - $ref: '#/components/schemas/limits_1' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CreditLimits_allOf_attributes' + required: + - attributes + type: object + title: Credit Account Limits + type: object + authorization: + additionalProperties: false + properties: + type: + default: authorization + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/authorization_attributes' + relationships: + title: authorizationRelationships + type: object + required: + - id + - relationships + - type + title: Authorization Document + type: object + authorizationRelationships: + title: authorizationRelationships + type: object + authorization_request: + discriminator: + mapping: + purchaseAuthorizationRequest: '#/components/schemas/PurchaseAuthorizationRequest' + cardTransactionAuthorizationRequest: '#/components/schemas/CardTransactionAuthorizationRequest' + atmAuthorizationRequest: '#/components/schemas/AtmAuthorizationRequest' + propertyName: type + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + title: AuthorizationRequest Document + type: object + PurchaseAuthorizationRequest: + allOf: + - $ref: '#/components/schemas/authorization_request' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/PurchaseAuthorizationRequest_allOf_attributes' + relationships: + $ref: '#/components/schemas/authorizationRequestRelationships' + required: + - relationships + type: object + title: PurchaseAuthorizationRequest Resource + type: object + authorizationRequestRelationships: + additionalProperties: false + properties: + customer: + $ref: '#/components/schemas/relationships_customer' + account: + $ref: '#/components/schemas/relationships_account' + fundingAccount: + $ref: '#/components/schemas/relationships_account' + card: + $ref: '#/components/schemas/authorizationRequestRelationships_card' + required: + - account + - card + - customer + title: authorizationRequestRelationships + type: object + CardTransactionAuthorizationRequest: + allOf: + - $ref: '#/components/schemas/authorization_request' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CardTransactionAuthorizationRequest_allOf_attributes' + relationships: + $ref: '#/components/schemas/authorizationRequestRelationships' + required: + - relationships + type: object + title: CardTransactionAuthorizationRequest Resource + type: object + AtmAuthorizationRequest: + allOf: + - $ref: '#/components/schemas/authorization_request' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/AtmAuthorizationRequest_allOf_attributes' + relationships: + $ref: '#/components/schemas/authorizationRequestRelationships' + required: + - relationships + type: object + title: AtmAuthorizationRequest Resource + type: object + approveAuthorizationRequest: + additionalProperties: false + properties: + type: + default: approveAuthorizationRequest + type: string + attributes: + $ref: '#/components/schemas/approveAuthorizationRequest_attributes' + required: + - attributes + - type + title: Approve Authorization Request + type: object + declineAuthorizationRequest: + additionalProperties: false + properties: + type: + default: declineAuthorizationRequest + type: string + attributes: + $ref: '#/components/schemas/declineAuthorizationRequest_attributes' + required: + - attributes + - type + title: Decline Authorization Request + type: object + statement: + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/statement_attributes' + relationships: + $ref: '#/components/schemas/statementRelationships' + required: + - attributes + - id + - relationships + - type + title: Statement + type: object + statementRelationships: + properties: + account: + $ref: '#/components/schemas/Relationship' + customer: + $ref: '#/components/schemas/Relationship' + customers: + $ref: '#/components/schemas/customersRelationship' + type: object + reward: + additionalProperties: false + properties: + type: + default: reward + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/reward_attributes' + relationships: + $ref: '#/components/schemas/rewardRelationships' + required: + - attributes + - id + - relationships + - type + title: Reward + type: object + rewardRelationships: + additionalProperties: false + properties: + receivingAccount: + $ref: '#/components/schemas/Relationship' + fundingAccount: + $ref: '#/components/schemas/Relationship' + customer: + $ref: '#/components/schemas/Relationship' + rewardedTransaction: + $ref: '#/components/schemas/Relationship' + transaction: + $ref: '#/components/schemas/transactionRelationship' + card: + $ref: '#/components/schemas/cardRelationship' + required: + - customer + - fundingAccount + - receivingAccount + type: object + createReward: + additionalProperties: false + properties: + type: + default: reward + type: string + attributes: + $ref: '#/components/schemas/createReward_attributes' + relationships: + $ref: '#/components/schemas/createRewardRelationships' + required: + - attributes + - relationships + - type + title: Reward + type: object + createRewardRelationships: + additionalProperties: false + properties: + fundingAccount: + $ref: '#/components/schemas/Relationship' + receivingAccount: + $ref: '#/components/schemas/Relationship' + rewardedTransaction: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction' + required: + - receivingAccount + type: object + event: + additionalProperties: false + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + properties: {} + type: object + relationships: + properties: {} + title: eventRelationships + type: object + required: + - id + - type + title: Event Resource + type: object + UnitEventResponse: + properties: + data: + $ref: '#/components/schemas/event' + title: UnitEventResponse + type: object + institution: + additionalProperties: false + properties: + type: + default: institution + type: string + attributes: + $ref: '#/components/schemas/institution_attributes' + required: + - attributes + - type + title: Institution Resource + type: object + createFee: + additionalProperties: false + properties: + type: + enum: + - fee + type: string + attributes: + $ref: '#/components/schemas/createFee_attributes' + relationships: + $ref: '#/components/schemas/createFeeRelationships' + required: + - attributes + - relationships + - type + title: Fee + type: object + createFeeRelationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/Relationship' + required: + - account + type: object + fee: + properties: + type: + default: fee + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/fee_attributes' + relationships: + $ref: '#/components/schemas/feeRelationships' + title: Fee + type: object + feeRelationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/Relationship' + required: + - account + title: feeRelationships + type: object + check_deposit: + additionalProperties: false + properties: + type: + enum: + - checkDeposit + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/check_deposit_attributes' + relationships: + $ref: '#/components/schemas/checkDepositRelationships' + required: + - attributes + - id + - relationships + - type + title: Check Deposit + type: object + statusEvent: + properties: + updatedAt: + type: string + updatedBy: + pattern: "^[1-9]\\d*$" + type: string + status: + $ref: '#/components/schemas/statusEvent_status' + required: + - status + type: object + checkDepositStatus: + enum: + - AwaitingImages + - AwaitingFrontImage + - AwaitingBackImage + - AwaitingCustomerConfirmation + - Pending + - PendingReview + - Rejected + - Clearing + - Sent + - Canceled + - Returned + type: string + checkDepositRelationships: + additionalProperties: false + properties: + org: + $ref: '#/components/schemas/orgRelationship' + account: + $ref: '#/components/schemas/checkDepositRelationships_account' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + transaction: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction' + required: + - account + title: checkDepositRelationships + type: object + createCheckDeposit: + additionalProperties: false + properties: + type: + enum: + - checkDeposit + type: string + attributes: + $ref: '#/components/schemas/createCheckDeposit_attributes' + relationships: + $ref: '#/components/schemas/createCheckDepositRelationships' + required: + - attributes + - relationships + - type + title: Check Deposit + type: object + createCheckDepositRelationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/Relationship' + required: + - account + type: object + update_check_deposit: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/patchCheckDeposit' + required: + - data + title: Patch Check Deposit + type: object + patchCheckDeposit: + additionalProperties: false + properties: + type: + default: checkDeposit + type: string + attributes: + $ref: '#/components/schemas/patchCheckDeposit_attributes' + required: + - attributes + - type + title: Patch Check Deposit + type: object + api_token: + additionalProperties: true + properties: + type: + default: apiToken + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/api_token_attributes' + required: + - attributes + - id + - type + title: apiToken + type: object + createApiToken: + additionalProperties: false + properties: + type: + default: apiToken + type: string + attributes: + $ref: '#/components/schemas/createApiToken_attributes' + required: + - attributes + - type + title: Create API Token + type: object + createCustomerToken: + properties: + type: + default: customerToken + type: string + attributes: + $ref: '#/components/schemas/createCustomerToken_attributes' + type: object + customer_token: + additionalProperties: false + properties: + type: + default: customerToken + type: string + attributes: + $ref: '#/components/schemas/customer_token_attributes' + required: + - attributes + - type + title: CustomerToken + type: object + createCustomerTokenVerification: + additionalProperties: false + properties: + type: + default: customerTokenVerification + type: string + attributes: + $ref: '#/components/schemas/createCustomerTokenVerification_attributes' + required: + - attributes + - type + type: object + customer_token_verification: + additionalProperties: false + properties: + type: + default: customerTokenVerification + type: string + attributes: + $ref: '#/components/schemas/customer_token_verification_attributes' + required: + - attributes + - type + title: CustomerTokenVerification + type: object + webhook: + additionalProperties: false + properties: + type: + default: webhook + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/webhook_attributes' + required: + - attributes + - id + - type + title: Webhook + type: object + updateUnitRequest: + properties: + data: + $ref: '#/components/schemas/updateUnitRequest_data' + type: object + transaction: + discriminator: + mapping: + originatedAchTransaction: '#/components/schemas/OriginatedAchTransaction' + receivedAchTransaction: '#/components/schemas/ReceivedAchTransaction' + returnedAchTransaction: '#/components/schemas/ReturnedAchTransaction' + returnedReceivedAchTransaction: '#/components/schemas/ReturnedReceivedAchTransaction' + dishonoredAchTransaction: '#/components/schemas/DishonoredAchTransaction' + purchaseTransaction: '#/components/schemas/PurchaseTransaction' + bookTransaction: '#/components/schemas/BookTransaction' + atmTransaction: '#/components/schemas/AtmTransaction' + feeTransaction: '#/components/schemas/FeeTransaction' + reversalTransaction: '#/components/schemas/ReversalTransaction' + cardTransaction: '#/components/schemas/CardTransaction' + releaseTransaction: '#/components/schemas/ReleaseTransaction' + wireTransaction: '#/components/schemas/WireTransaction' + interchangeTransaction: '#/components/schemas/InterchangeTransaction' + interestShareTransaction: '#/components/schemas/InterestShareTransaction' + interestTransaction: '#/components/schemas/InterestTransaction' + adjustmentTransaction: '#/components/schemas/AdjustmentTransaction' + disputeSettlementTransaction: '#/components/schemas/DisputeSettlementTransaction' + disputeTransaction: '#/components/schemas/DisputeTransaction' + checkDepositTransaction: '#/components/schemas/CheckDepositTransaction' + returnedCheckDepositTransaction: '#/components/schemas/ReturnedCheckDepositTransaction' + billPayTransaction: '#/components/schemas/BillPayTransaction' + settlementTransaction: '#/components/schemas/SettlementTransaction' + sponsoredInterestTransaction: '#/components/schemas/SponsoredInterestTransaction' + paymentAdvanceTransaction: '#/components/schemas/PaymentAdvanceTransaction' + repaidPaymentAdvanceTransaction: '#/components/schemas/RepaidPaymentAdvanceTransaction' + chargebackTransaction: '#/components/schemas/ChargebackTransaction' + rewardTransaction: '#/components/schemas/RewardTransaction' + negativeBalanceCoverageTransaction: '#/components/schemas/NegativeBalanceCoverageTransaction' + accountLowBalanceClosureTransaction: '#/components/schemas/AccountLowBalanceClosureTransaction' + bankRepaymentTransaction: '#/components/schemas/BankRepaymentTransaction' + cashDepositTransaction: '#/components/schemas/CashDepositTransaction' + customerRepaymentTransaction: '#/components/schemas/CustomerRepaymentTransaction' + customerRepaymentReturnedTransaction: '#/components/schemas/CustomerRepaymentReturnedTransaction' + checkPaymentTransaction: '#/components/schemas/CheckPaymentTransaction' + returnedCheckPaymentTransaction: '#/components/schemas/ReturnedCheckPaymentTransaction' + propertyName: type + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + type: string + title: Transaction Resource + type: object + OriginatedAchTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/OriginatedAchTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Originated ACH + type: object + transactionRelationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/accountRelationship_2' + receivingAccount: + $ref: '#/components/schemas/receivingAccountRelationship' + customer: + $ref: '#/components/schemas/customerRelationship' + customers: + $ref: '#/components/schemas/customersRelationship' + counterpartyAccount: + $ref: '#/components/schemas/counterpartyAccountRelationship_1' + counterpartyCustomer: + $ref: '#/components/schemas/counterpartyCustomerRelationship' + relatedTransaction: + $ref: '#/components/schemas/relatedTransactionRelationship' + disputedTransaction: + $ref: '#/components/schemas/relatedTransaction' + authorization: + $ref: '#/components/schemas/authorizationRelationship' + returned: + $ref: '#/components/schemas/returnedRelationship' + payment: + $ref: '#/components/schemas/paymentRelationship' + checkPayment: + $ref: '#/components/schemas/checkPaymentRelationship' + repayment: + $ref: '#/components/schemas/repaymentRelationship' + recurringPayment: + $ref: '#/components/schemas/recurringPaymentRelationship' + org: + $ref: '#/components/schemas/orgRelationship' + card: + $ref: '#/components/schemas/cardRelationship' + incomingAch: + $ref: '#/components/schemas/incomingAchRelationship' + checkDeposit: + $ref: '#/components/schemas/checkDepositRelationship' + authorizationRequest: + $ref: '#/components/schemas/authorizationRequestRelationship' + paymentAdvanceTransaction: + $ref: '#/components/schemas/relatedTransaction' + receivedPayment: + $ref: '#/components/schemas/receivedPaymentRelationship' + chargeback: + $ref: '#/components/schemas/chargebackRelationship' + reward: + $ref: '#/components/schemas/rewardRelationship' + required: + - account + title: transactionRelationships + type: object + relatedTransaction: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction_data' + required: + - data + title: relatedTransactionRelationship + type: object + ReceivedAchTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReceivedAchTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Received ACH + type: object + ReturnedAchTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReturnedAchTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Returned ACH + type: object + ReturnedReceivedAchTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReturnedReceivedAchTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Returned Received ACH + type: object + DishonoredAchTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/DishonoredAchTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Dishonored Return ACH + type: object + PurchaseTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/PurchaseTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Purchase + type: object + BookTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BookTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Book + type: object + AtmTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/AtmTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: ATM + type: object + FeeTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Fee + type: object + ReversalTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReversalTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Reversal + type: object + CardTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CardTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: cardTransaction + type: object + ReleaseTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReleaseTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: releaseTransaction + type: object + WireTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/WireTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: wireTransaction + type: object + InterchangeTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: interchangeShareTransaction + type: object + InterestShareTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: interestShareTransaction + type: object + InterestTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: interestTransaction + type: object + AdjustmentTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/AdjustmentTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: adjustmentTransaction + type: object + DisputeSettlementTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: disputeSettlementTransaction + type: object + DisputeTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/DisputeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: disputeTransaction + type: object + CheckDepositTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: checkDepositTransaction + type: object + ReturnedCheckDepositTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReturnedCheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: returnedCheckDepositTransaction + type: object + BillPayTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: billPayTransaction + type: object + SettlementTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: settlementTransaction + type: object + SponsoredInterestTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: sponsoredInterestTransaction + type: object + PaymentAdvanceTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: paymentAdvanceTransaction + type: object + RepaidPaymentAdvanceTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: repaidPaymentAdvanceTransaction + type: object + ChargebackTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ChargebackTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Chargeback + type: object + RewardTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/RewardTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: Reward + type: object + NegativeBalanceCoverageTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: NegativeBalanceCoverage + type: object + AccountLowBalanceClosureTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/AccountLowBalanceClosureTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: AccountLowBalanceClosure + type: object + BankRepaymentTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/BankRepaymentTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: bankRepaymentTransaction + type: object + CashDepositTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CashDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: cashDepositTransaction + type: object + CustomerRepaymentTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: customerRepaymentTransaction + type: object + CustomerRepaymentReturnedTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/FeeTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: customerRepaymentReturnedTransaction + type: object + CheckPaymentTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/CheckDepositTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: checkPaymentTransaction + type: object + ReturnedCheckPaymentTransaction: + allOf: + - $ref: '#/components/schemas/transaction' + - additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/ReturnedCheckPaymentTransaction_allOf_attributes' + relationships: + $ref: '#/components/schemas/transactionRelationships' + required: + - attributes + - relationships + type: object + title: returnedCheckPaymentTransaction + type: object + update_transaction: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/update_transaction_data' + required: + - data + title: Patch Transaction + type: object + patchTransactionTags: + additionalProperties: false + properties: + type: + default: transaction + type: string + attributes: + $ref: '#/components/schemas/patchTransactionTags_attributes' + required: + - attributes + - type + title: Patch Transaction + type: object + patchBookTransaction: + additionalProperties: false + properties: + type: + default: bookTransaction + type: string + attributes: + $ref: '#/components/schemas/patchBookTransaction_attributes' + relationships: + $ref: '#/components/schemas/patchBookTransaction_relationships' + required: + - attributes + - type + title: Patch Book Transaction + type: object + accountRelationship_1: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/accountRelationship_data' + required: + - data + type: object + patchChargebackTransaction: + additionalProperties: false + properties: + type: + default: chargebackTransaction + type: string + attributes: + $ref: '#/components/schemas/patchBookTransaction_attributes' + relationships: + $ref: '#/components/schemas/patchBookTransaction_relationships' + required: + - attributes + - type + title: Patch Chargeback Transaction + type: object + dispute: + additionalProperties: false + properties: + type: + default: dispute + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/dispute_attributes' + relationships: + $ref: '#/components/schemas/disputeRelationships' + required: + - id + - relationships + - type + title: Dispute Document + type: object + disputeRelationships: + additionalProperties: false + properties: + customer: + $ref: '#/components/schemas/Relationship' + account: + $ref: '#/components/schemas/Relationship' + transaction: + $ref: '#/components/schemas/Relationship' + required: + - account + - customer + - transaction + title: disputeRelationships + type: object + repayment: + discriminator: + mapping: + achRepayment: '#/components/schemas/AchRepayment' + bookRepayment: '#/components/schemas/BookRepayment' + propertyName: type + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + type: string + title: Repayment Resource + type: object + AchRepayment: + allOf: + - $ref: '#/components/schemas/repayment' + - properties: + attributes: + $ref: '#/components/schemas/AchRepayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/AchRepayment_allOf_relationships' + type: object + title: ACH Repayment + type: object + BookRepayment: + allOf: + - $ref: '#/components/schemas/repayment' + - properties: + attributes: + $ref: '#/components/schemas/BookRepayment_allOf_attributes' + relationships: + $ref: '#/components/schemas/BookRepayment_allOf_relationships' + type: object + title: Book Repayment + type: object + createRepayment: + properties: + data: + $ref: '#/components/schemas/createRepayment_data' + title: Create Repayment + type: object + CreateAchRepayment: + additionalProperties: false + properties: + type: + default: achRepayment + type: string + attributes: + $ref: '#/components/schemas/CreateAchRepayment_attributes' + relationships: + $ref: '#/components/schemas/CreateAchRepayment_relationships' + required: + - attributes + - relationships + - type + title: Create ACH Repayment + type: object + CreateBookRepayment: + additionalProperties: false + properties: + type: + default: bookRepayment + type: string + attributes: + $ref: '#/components/schemas/CreateBookRepayment_attributes' + relationships: + $ref: '#/components/schemas/CreateBookRepayment_relationships' + required: + - attributes + - relationships + - type + title: Create Book Repayment + type: object + UnitRepaymentResponse: + properties: + data: + $ref: '#/components/schemas/repayment' + title: UnitRepaymentResponse + type: object + CheckPayment: + additionalProperties: false + properties: + type: + default: checkPayment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/CheckPayment_attributes' + relationships: + $ref: '#/components/schemas/CheckPayment_relationships' + required: + - attributes + - id + - relationships + - type + title: Check Payment Resource + type: object + returnReason: + enum: + - InsufficientFunds + - AccountClosed + - AlteredCheck + - ForgedSignature + - PostdatedCheck + - StopPaymentOrder + - UnauthorizedDebit + - WrongAmount + - DuplicatePayment + - MissingSignature + - IrregularEndorsement + - Other + type: string + UnitCheckPaymentResponse: + properties: + data: + $ref: '#/components/schemas/CheckPayment' + title: UnitCheckPaymentResponse + type: object + createCheckPayment: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/CheckPayment' + required: + - data + title: Create Check Payment + type: object + StopPaymentListResponse: + example: + data: + - relationships: + checkPayments: + data: + - id: id + type: checkPayment + - id: id + type: checkPayment + customers: + data: + - id: id + type: customer + - id: id + type: customer + account: + data: + id: id + type: depositAccount + customer: + data: + id: id + type: businessCustomer + attributes: + createdAt: 2000-01-23T04:56:07.000+00:00 + amount: 1 + checkNumber: checkNumber + updatedAt: 2000-01-23T04:56:07.000+00:00 + status: Active + tags: "{}" + id: id + type: stopPayment + - relationships: + checkPayments: + data: + - id: id + type: checkPayment + - id: id + type: checkPayment + customers: + data: + - id: id + type: customer + - id: id + type: customer + account: + data: + id: id + type: depositAccount + customer: + data: + id: id + type: businessCustomer + attributes: + createdAt: 2000-01-23T04:56:07.000+00:00 + amount: 1 + checkNumber: checkNumber + updatedAt: 2000-01-23T04:56:07.000+00:00 + status: Active + tags: "{}" + id: id + type: stopPayment + properties: + data: + items: + $ref: '#/components/schemas/stop_payment' + type: array + type: object + StopPaymentResponse: + example: + data: + relationships: + checkPayments: + data: + - id: id + type: checkPayment + - id: id + type: checkPayment + customers: + data: + - id: id + type: customer + - id: id + type: customer + account: + data: + id: id + type: depositAccount + customer: + data: + id: id + type: businessCustomer + attributes: + createdAt: 2000-01-23T04:56:07.000+00:00 + amount: 1 + checkNumber: checkNumber + updatedAt: 2000-01-23T04:56:07.000+00:00 + status: Active + tags: "{}" + id: id + type: stopPayment + properties: + data: + $ref: '#/components/schemas/stop_payment' + type: object + createStopPayment: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/stopPayment' + required: + - data + title: Create Stop Payment + type: object + stopPayment: + additionalProperties: false + properties: + type: + default: stopPayment + type: string + attributes: + $ref: '#/components/schemas/stopPayment_attributes' + relationships: + $ref: '#/components/schemas/relationships_1' + required: + - attributes + - relationships + - type + title: Stop Payment + type: object + relationships_1: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/relationships_1_account' + required: + - account + type: object + tagsPatch: + additionalProperties: false + maxProperties: 15 + type: object + businessAnnualRevenue: + enum: + - UpTo250k + - Between250kAnd500k + - Between500kAnd1m + - Between1mAnd5m + - Over5m + type: string + businessNumberOfEmployees: + enum: + - UpTo10 + - Between10And50 + - Between50And100 + - Between100And500 + - Over500 + type: string + cashFlow: + enum: + - Unpredictable + - Predictable + type: string + year: + pattern: "^\\d{4}$" + type: string + country: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + businessVertical: + enum: + - AdultEntertainmentDatingOrEscortServices + - AgricultureForestryFishingOrHunting + - ArtsEntertainmentAndRecreation + - BusinessSupportOrBuildingServices + - Cannabis + - Construction + - DirectMarketingOrTelemarketing + - EducationalServices + - FinancialServicesCryptocurrency + - FinancialServicesDebitCollectionOrConsolidation + - FinancialServicesMoneyServicesBusinessOrCurrencyExchange + - FinancialServicesOther + - FinancialServicesPaydayLending + - GamingOrGambling + - HealthCareAndSocialAssistance + - HospitalityAccommodationOrFoodServices + - LegalAccountingConsultingOrComputerProgramming + - Manufacturing + - Mining + - Nutraceuticals + - PersonalCareServices + - PublicAdministration + - RealEstate + - ReligiousCivicAndSocialOrganizations + - RepairAndMaintenance + - RetailTrade + - TechnologyMediaOrTelecom + - TransportationOrWarehousing + - Utilities + - WholesaleTrade + type: string + fullName: + additionalProperties: false + properties: + first: + maxLength: 255 + minLength: 1 + type: string + last: + maxLength: 255 + minLength: 1 + type: string + required: + - first + - last + title: Full Name + type: object + ssn: + pattern: "^\\d{9}$" + type: string + address: + additionalProperties: false + properties: + street: + maxLength: 255 + minLength: 1 + pattern: ^.*$ + type: string + street2: + nullable: true + pattern: ^.*$ + type: string + city: + maxLength: 255 + minLength: 1 + pattern: ^.*$ + type: string + state: + type: string + postalCode: + pattern: "^[0-9]{5}(?:-[0-9]{4})?$" + type: string + country: + default: US + type: string + required: + - city + - country + - postalCode + - state + - street + title: Address + type: object + phone: + additionalProperties: false + properties: + countryCode: + type: string + number: + type: string + required: + - countryCode + - number + title: Phone + type: object + occupation: + enum: + - ArchitectOrEngineer + - BusinessAnalystAccountantOrFinancialAdvisor + - CommunityAndSocialServicesWorker + - ConstructionMechanicOrMaintenanceWorker + - Doctor + - Educator + - EntertainmentSportsArtsOrMedia + - ExecutiveOrManager + - FarmerFishermanForester + - FoodServiceWorker + - GigWorker + - HospitalityOfficeOrAdministrativeSupportWorker + - HouseholdManager + - JanitorHousekeeperLandscaper + - Lawyer + - ManufacturingOrProductionWorker + - MilitaryOrPublicSafety + - NurseHealthcareTechnicianOrHealthcareSupport + - PersonalCareOrServiceWorker + - PilotDriverOperator + - SalesRepresentativeBrokerAgent + - ScientistOrTechnologist + - Student + type: string + annualIncome: + enum: + - UpTo10k + - Between10kAnd25k + - Between25kAnd50k + - Between50kAnd100k + - Between100kAnd250k + - Over250k + type: string + sourceOfIncome: + enum: + - EmploymentOrPayrollIncome + - PartTimeOrContractorIncome + - InheritancesAndGifts + - PersonalInvestments + - BusinessOwnershipInterests + - GovernmentBenefits + type: string + soleProprietorshipAnnualRevenue: + enum: + - UpTo50k + - Between50kAnd100k + - Between100kAnd200k + - Between200kAnd500k + - Over500k + type: string + soleProprietorshipNumberOfEmployees: + enum: + - One + - Between2And5 + - Between5And10 + - Over10 + type: string + identifier: + pattern: "^[1-9]\\d*$" + type: string + applicationStatus: + enum: + - AwaitingDocuments + - PendingReview + - Approved + - Denied + - Pending + - Canceled + type: string + email: + format: email + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + jwtSubject: + nullable: true + type: string + industry: + enum: + - Retail + - Wholesale + - Restaurants + - Hospitals + - Construction + - Insurance + - Unions + - RealEstate + - FreelanceProfessional + - OtherProfessionalServices + - OnlineRetailer + - OtherEducationServices + type: string + orgRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/orgRelationship_data' + required: + - data + type: object + Relationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/Relationship_data' + required: + - data + type: object + entityType: + enum: + - Corporation + - LLC + - Partnership + - PubliclyTradedCorporation + - PrivatelyHeldCorporation + - NotForProfitOrganization + type: string + state: + pattern: "^((A[LKSZR])|(C[AOT])|(D[EC])|(F[ML])|(G[AU])|(HI)|(I[DLNA])|(K[SY])|(LA)|(M[EHDAINSOT])|(N[EVHJMYCD])|(MP)|(O[HKR])|(P[WAR])|(RI)|(S[CD])|(T[NX])|(UT)|(V[TIA])|(W[AVIY]))$" + type: string + contact: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + jwtSubject: + nullable: true + type: string + title: Contact + type: object + revocability: + enum: + - Revocable + - Irrevocable + type: string + sourceOfFunds: + enum: + - Inheritance + - Salary + - Savings + - InvestmentReturns + - Gifts + type: string + trustContact: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + jwtSubject: + nullable: true + type: string + title: TrustContact + type: object + trustee: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + required: + - address + - dateOfBirth + - email + - fullName + - phone + title: Trustee + type: object + grantor: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + matriculaConsular: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + evaluationId: + type: string + evaluationFlags: + items: + type: string + type: array + status: + type: string + maskedSSN: + pattern: "^\\*{5}\\d{4}$" + type: string + required: + - address + - dateOfBirth + - email + - fullName + - phone + title: Grantor + type: object + deviceFingerprint: + additionalProperties: false + properties: + provider: + enum: + - iovation + type: string + value: + type: string + required: + - provider + - value + type: object + beneficiary: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + dateOfBirth: + format: date + type: string + required: + - dateOfBirth + - fullName + title: Beneficiary + type: object + url: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + applicationFormAdditionalDisclosures: + items: + $ref: '#/components/schemas/applicationFormAdditionalDisclosures_inner' + type: array + applicationFormValidatePhoneNumber: + default: true + type: boolean + customerLinkage: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/customerLinkage_data' + required: + - data + type: object + authorizedUser: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + jwtSubject: + nullable: true + type: string + required: + - email + - fullName + - phone + title: Authorized User + type: object + customersRelationship: + example: + data: + - id: id + type: customer + - id: id + type: customer + properties: + data: + items: + $ref: '#/components/schemas/customersRelationship_data_inner' + type: array + title: Customers Relationship + type: object + responseContact: + allOf: + - $ref: '#/components/schemas/contact' + required: + - fullName + wireCounterparty: + additionalProperties: false + properties: + routingNumber: + pattern: "^\\d{9}$" + type: string + accountNumber: + maxLength: 17 + type: string + name: + maxLength: 50 + minLength: 1 + type: string + address: + $ref: '#/components/schemas/address' + required: + - accountNumber + - address + - name + - routingNumber + title: WireCounterparty + type: object + astra: + additionalProperties: false + properties: + authToken: + minLength: 1 + type: string + debitFeePercent: + type: number + institutionId: + minLength: 1 + type: string + destinationCardId: + minLength: 1 + type: string + routingNumber: + minLength: 1 + type: string + accountNumber: + minLength: 1 + type: string + accountName: + minLength: 1 + type: string + referenceId: + maxLength: 80 + minLength: 1 + type: string + required: + - accountNumber + - debitFeePercent + - destinationCardId + - institutionId + - referenceId + - routingNumber + title: AstraPushToCardConfiguration + type: object + plaidProcessorToken: + maxLength: 60 + minLength: 40 + pattern: ^processor-.*$ + type: string + cardLevelLimits: + additionalProperties: false + properties: + dailyWithdrawal: + type: integer + dailyPurchase: + type: integer + monthlyWithdrawal: + type: integer + monthlyPurchase: + type: integer + type: object + merchant: + additionalProperties: false + properties: + name: + type: string + type: + type: integer + category: + type: string + location: + type: string + id: + type: string + required: + - category + - name + - type + title: Merchant + type: object + cardVerificationData: + additionalProperties: false + properties: + verificationMethod: + type: string + required: + - verificationMethod + title: Card Verification Data + type: object + healthcareAmounts: + additionalProperties: false + properties: + transitAmount: + type: integer + prescriptionRXAmount: + type: integer + visionOpticalAmount: + type: integer + clinicOtherQualifiedMedicalAmount: + type: integer + dentalAmount: + type: integer + totalHealthcareAmount: + type: integer + required: + - clinicOtherQualifiedMedicalAmount + - dentalAmount + - prescriptionRXAmount + - totalHealthcareAmount + - transitAmount + - visionOpticalAmount + title: Healthcare Amounts + type: object + counterparty_2: + additionalProperties: false + properties: + routingNumber: + pattern: "^\\d{9}$" + type: string + accountNumber: + maxLength: 17 + type: string + name: + maxLength: 250 + minLength: 1 + type: string + required: + - accountNumber + - name + - routingNumber + title: Counterparty + type: object + coordinates: + additionalProperties: false + properties: + longitude: + type: number + latitude: + type: number + required: + - latitude + - longitude + type: object + description: + maxLength: 1024 + type: string + stop_payment: + additionalProperties: false + example: + relationships: + checkPayments: + data: + - id: id + type: checkPayment + - id: id + type: checkPayment + customers: + data: + - id: id + type: customer + - id: id + type: customer + account: + data: + id: id + type: depositAccount + customer: + data: + id: id + type: businessCustomer + attributes: + createdAt: 2000-01-23T04:56:07.000+00:00 + amount: 1 + checkNumber: checkNumber + updatedAt: 2000-01-23T04:56:07.000+00:00 + status: Active + tags: "{}" + id: id + type: stopPayment + properties: + type: + default: stopPayment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + attributes: + $ref: '#/components/schemas/stop_payment_attributes' + relationships: + $ref: '#/components/schemas/stop_payment_relationships' + required: + - attributes + - id + - relationships + - type + title: Stop Payment + type: object + execute_request_data_attributes: + properties: + reason: + type: string + type: object + execute_request_data: + properties: + type: + enum: + - cancelApplication + type: string + attributes: + $ref: '#/components/schemas/execute_request_data_attributes' + type: object + execute_request: + properties: + data: + $ref: '#/components/schemas/execute_request_data' + type: object + UnitCancelApplicationResponse: + properties: + data: + $ref: '#/components/schemas/application' + included: + items: + $ref: '#/components/schemas/document' + type: array + title: UnitCancelApplicationResponse + type: object + execute_filter_parameter: + properties: + query: + type: string + status: + items: + enum: + - AwaitingDocuments + - PendingReview + - Pending + - Approved + - Denied + - Canceled + type: string + type: array + email: + type: string + tags: + additionalProperties: + type: string + type: object + type: object + UnitListApplicationsResponse: + example: + data: + - id: id + type: type + - id: id + type: type + meta: + pagination: + total: 1 + offset: 6 + limit: 0 + properties: + data: + items: + $ref: '#/components/schemas/application' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitListApplicationsResponse + type: object + UnitCreateApplicationResponse: + properties: + data: + $ref: '#/components/schemas/application' + included: + items: + $ref: '#/components/schemas/document' + type: array + title: UnitCreateApplicationResponse + type: object + execute_filter_parameter_1: + properties: + query: + type: string + status: + items: + enum: + - Pending + - Approved + type: string + type: array + email: + type: string + tags: + type: object + type: object + UnitApplicationFormsListResponse: + properties: + data: + items: + $ref: '#/components/schemas/application_form' + type: array + title: UnitApplicationFormsListResponse + type: object + execute_request_1: + properties: + data: + $ref: '#/components/schemas/createApplicationForm' + type: object + UnitApplicationFormResponse: + properties: + data: + $ref: '#/components/schemas/application_form' + title: UnitApplicationFormResponse + type: object + execute_200_response: + properties: + data: + items: + $ref: '#/components/schemas/document' + type: array + type: object + execute_request_2: + properties: + jobId: + type: string + type: object + UnitApplicationFormResponseWithIncluded: + properties: + data: + $ref: '#/components/schemas/application_form' + included: + $ref: '#/components/schemas/application' + title: UnitApplicationFormResponseWithIncluded + type: object + execute_filter_parameter_2: + properties: + customerId: + type: string + status: + items: + enum: + - Open + - Frozen + - Closed + type: string + type: array + type: + items: + enum: + - deposit + - credit + type: string + type: array + fromBalance: + type: number + toBalance: + type: number + tags: + type: object + type: object + UnitAccountsListResponse: + properties: + data: + items: + $ref: '#/components/schemas/account' + type: array + included: + items: + $ref: '#/components/schemas/customer' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitAccountsListResponse + type: object + UnitGetAccountLimitsResponse: + properties: + data: + $ref: '#/components/schemas/limits' + title: UnitGetAccountLimitsResponse + type: object + execute_request_3: + properties: + data: + $ref: '#/components/schemas/freezeAccountRequest' + type: object + execute_request_4: + properties: + data: + $ref: '#/components/schemas/closeAccountRequest' + type: object + UnitGetAccountEndOfDayListResponse: + properties: + data: + $ref: '#/components/schemas/account_end_of_day' + title: UnitGetAccountEndOfDayListResponse + type: object + execute_filter_parameter_3: + properties: + query: + type: string + status: + items: + enum: + - Active + - Archived + type: string + type: array + email: + type: string + tags: + type: object + type: object + UnitCustomersListResponse: + properties: + data: + items: + $ref: '#/components/schemas/customer' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitCustomersListResponse + type: object + execute_request_5_attributes: + properties: + reason: + enum: + - Inactive + - FraudACHActivity + - FraudCardActivity + - FraudCheckActivity + - FraudApplicationHistory + - FraudAccountActivity + - FraudClientIdentified + - FraudLinkedToFraudulentCustomer + type: string + type: object + execute_request_5: + properties: + type: + enum: + - archiveCustomer + type: string + attributes: + $ref: '#/components/schemas/execute_request_5_attributes' + type: object + execute_filter_parameter_4: + properties: + accountId: + type: string + customerId: + type: string + counterpartyAccountId: + type: string + status: + items: + enum: + - Rejected + - Pending + - Canceled + - Pending Review + - Clearing + - Sent + - Returned + type: string + type: array + type: + items: + enum: + - AchPayment + - BookPayment + - WirePayment + type: string + type: array + direction: + items: + enum: + - Debit + - Credit + type: string + type: array + since: + type: string + until: + type: string + fromAmount: + type: integer + toAmount: + type: integer + recurringPaymentId: + type: integer + feature: + items: + enum: + - SameDay + - RecurringPayment + type: string + type: array + tags: + type: object + type: object + UnitPaymentsListResponse: + properties: + data: + items: + $ref: '#/components/schemas/payment' + type: array + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitPaymentsListResponse + type: object + execute_request_6: + properties: + data: + $ref: '#/components/schemas/createPayment' + type: object + UnitPaymentResponseWithIncluded: + properties: + data: + $ref: '#/components/schemas/payment' + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + title: UnitPaymentResponseWithIncluded + type: object + UnitReceivedPaymentListResponse: + properties: + data: + items: + $ref: '#/components/schemas/received_payment' + type: array + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitReceivedPaymentListResponse + type: object + UnitReceivedPaymentResponseWithIncluded: + properties: + data: + $ref: '#/components/schemas/received_payment' + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + title: UnitReceivedPaymentResponseWithIncluded + type: object + execute_filter_parameter_5: + properties: + customerId: + type: string + accountNumber: + type: string + routingNumber: + type: string + permissions: + items: + enum: + - CreditOnly + - DebitOnly + - CreditAndDebit + type: string + type: array + tags: + type: object + type: object + UnitCounterpartiesListResponse: + properties: + data: + $ref: '#/components/schemas/counterparty_1' + title: UnitCounterpartiesListResponse + type: object + execute_request_7: + properties: + data: + $ref: '#/components/schemas/createCounterparty' + type: object + UnitCounterpartyResponse: + properties: + data: + $ref: '#/components/schemas/counterparty_1' + title: UnitCounterpartyResponse + type: object + UnitCounterpartyResponse_1: + properties: + data: + $ref: '#/components/schemas/counterparty_balance' + title: UnitCounterpartyResponse + type: object + execute_filter_parameter_6: + properties: + accountId: + type: string + customerId: + type: string + status: + items: + type: string + type: array + type: + items: + enum: + - recurringCreditAchPayment + - recurringDebitAchPayment + - recurringCreditBookPayment + type: string + type: array + fromStartTime: + type: string + toStartTime: + type: string + fromEndTime: + type: string + toEndTime: + type: string + type: object + UnitRecurringPaymentListResponse: + properties: + data: + items: + $ref: '#/components/schemas/recurring_payment' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitRecurringPaymentListResponse + type: object + execute_request_8: + properties: + data: + $ref: '#/components/schemas/createRecurringPayment' + type: object + execute_filter_parameter_7: + properties: + status: + items: + enum: + - Inactive + - Active + - Stolen + - Lost + - Frozen + - ClosedByCustomer + - SuspectedFraud + type: string + type: array + accountId: + type: string + customerId: + type: string + tags: + type: object + type: object + UnitCardResponseCardsList: + properties: + data: + items: + $ref: '#/components/schemas/card' + type: array + included: + items: + $ref: '#/components/schemas/IncludedResource' + type: array + title: UnitCardResponseCardsList + type: object + execute_request_9: + properties: + data: + $ref: '#/components/schemas/createCard' + type: object + UnitCardResponse: + properties: + data: + $ref: '#/components/schemas/card' + title: UnitCardResponse + type: object + UnitCardResponse_1: + properties: + data: + $ref: '#/components/schemas/card' + included: + items: + $ref: '#/components/schemas/IncludedResource' + type: array + title: UnitCardResponse + type: object + UnitCardResponse_2: + properties: + data: + $ref: '#/components/schemas/pinStatus' + title: UnitCardResponse + type: object + UnitCardResponse_3: + properties: + data: + $ref: '#/components/schemas/limits_1' + title: UnitCardResponse + type: object + execute_filter_parameter_8: + properties: + accountId: + type: string + accountType: + type: string + customerId: + type: string + cardId: + type: string + includeNonAuthorized: + type: boolean + merchantCategoryCode: + items: + type: string + type: array + since: + type: string + until: + type: string + fromAmount: + type: integer + toAmount: + type: integer + status: + items: + enum: + - Authorized + - Completed + - Canceled + - Declined + type: string + type: array + type: object + execute_200_response_1: + properties: + data: + items: + $ref: '#/components/schemas/authorization' + type: array + type: object + UnitAuthorizationResponse: + properties: + data: + $ref: '#/components/schemas/authorization' + title: UnitAuthorizationResponse + type: object + execute_filter_parameter_9: + properties: + accountId: + type: string + customerId: + type: string + merchantCategoryCode: + items: + type: string + type: array + fromAmount: + type: integer + toAmount: + type: integer + type: object + execute_200_response_2: + properties: + data: + items: + $ref: '#/components/schemas/authorization_request' + type: array + type: object + UnitAuthorizationRequestsResponse: + properties: + data: + $ref: '#/components/schemas/authorization_request' + title: UnitAuthorizationRequestsResponse + type: object + execute_request_10: + properties: + data: + $ref: '#/components/schemas/approveAuthorizationRequest' + type: object + UnitAuthorizationRequestResponse: + properties: + data: + $ref: '#/components/schemas/authorization_request' + title: UnitAuthorizationRequestResponse + type: object + execute_request_11: + properties: + data: + $ref: '#/components/schemas/declineAuthorizationRequest' + type: object + execute_filter_parameter_10: + properties: + accountId: + type: string + customerId: + type: string + period: + type: string + type: object + UnitStatementsResponse: + properties: + data: + items: + $ref: '#/components/schemas/statement' + type: array + title: UnitStatementsResponse + type: object + execute_filter_parameter_11: + properties: + transactionId: + type: string + rewardedTransactionId: + type: string + receivingAccountId: + type: string + customerId: + type: string + cardId: + type: string + since: + type: string + until: + type: string + status: + type: string + tags: + type: object + type: object + UnitRewardsListResponse: + properties: + data: + items: + $ref: '#/components/schemas/reward' + type: array + title: UnitRewardsListResponse + type: object + execute_request_12: + properties: + data: + $ref: '#/components/schemas/createReward' + type: object + UnitRewardResponse: + properties: + data: + $ref: '#/components/schemas/reward' + title: UnitRewardResponse + type: object + execute_filter_parameter_12: + properties: + since: + type: string + until: + type: string + type: + items: + type: string + type: array + type: object + UnitEventListResponse: + properties: + data: + items: + $ref: '#/components/schemas/event' + type: array + title: UnitEventListResponse + type: object + UnitEventResponse_1: + properties: + data: + $ref: '#/components/schemas/event' + title: UnitEventResponse + type: object + UnitInstitutionResponse: + properties: + data: + $ref: '#/components/schemas/institution' + title: UnitInstitutionResponse + type: object + execute_request_13: + properties: + data: + $ref: '#/components/schemas/createFee' + type: object + UnitFeeResponse: + properties: + data: + $ref: '#/components/schemas/fee' + title: UnitFeeResponse + type: object + execute_filter_parameter_13: + properties: + accountId: + type: string + customerId: + type: string + tags: + type: object + status: + items: + enum: + - AwaitingImages + - AwaitingFrontImage + - AwaitingBackImage + - Pending + - PendingReview + - Rejected + - Clearing + - Sent + - Canceled + - Returned + - AwaitingCustomerConfirmation + type: string + type: array + type: object + execute_request_14: + properties: + data: + $ref: '#/components/schemas/createCheckDeposit' + type: object + UnitCheckDepositResponse: + properties: + data: + $ref: '#/components/schemas/check_deposit' + title: UnitCheckDepositResponse + type: object + UnitCheckDepositResponse_1: + properties: + data: + type: string + title: UnitCheckDepositResponse + type: object + UnitOrgApiTokensListResponse: + properties: + data: + items: + $ref: '#/components/schemas/api_token' + type: array + title: UnitOrgApiTokensListResponse + type: object + execute_request_15: + properties: + data: + $ref: '#/components/schemas/createApiToken' + type: object + UnitApiTokenResponse: + properties: + data: + $ref: '#/components/schemas/api_token' + title: UnitApiTokenResponse + type: object + execute_request_16: + properties: + data: + $ref: '#/components/schemas/createCustomerToken' + type: object + UnitCustomerTokenResponse: + properties: + data: + $ref: '#/components/schemas/customer_token' + title: UnitCustomerTokenResponse + type: object + execute_request_17: + properties: + data: + $ref: '#/components/schemas/createCustomerTokenVerification' + type: object + UnitCustomerTokenVerificationResponse: + properties: + data: + $ref: '#/components/schemas/customer_token_verification' + title: UnitCustomerTokenVerificationResponse + type: object + execute_filter_parameter_14: + properties: + since: + type: string + until: + type: string + fromId: + type: integer + toId: + type: integer + type: object + UnitWebhooksListResponse: + properties: + data: + items: + $ref: '#/components/schemas/webhook' + type: array + title: UnitWebhooksListResponse + type: object + createWebhook_data_attributes: + additionalProperties: false + properties: + label: + type: string + url: + type: string + token: + type: string + contentType: + enum: + - Json + - JsonAPI + type: string + deliveryMode: + type: string + includeResources: + type: boolean + subscriptionType: + enum: + - All + - OnlyAuthorizationRequest + type: string + required: + - contentType + - deliveryMode + - label + - token + - url + type: object + createWebhook_data: + properties: + type: + default: webhook + type: string + attributes: + $ref: '#/components/schemas/createWebhook_data_attributes' + type: object + createWebhook: + properties: + data: + $ref: '#/components/schemas/createWebhook_data' + title: createWebhook + type: object + UnitWebhookResponse: + properties: + data: + $ref: '#/components/schemas/webhook' + title: UnitWebhookResponse + type: object + execute_filter_parameter_15: + properties: + coordinates: + type: object + searchRadius: + type: integer + postalCode: + type: string + address: + type: object + type: object + UnitTransactionResponse: + properties: + data: + $ref: '#/components/schemas/transaction' + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + title: UnitTransactionResponse + type: object + UnitTransactionResponse_1: + properties: + data: + $ref: '#/components/schemas/transaction' + title: UnitTransactionResponse + type: object + execute_filter_parameter_16: + properties: + accountId: + type: string + customerId: + type: string + query: + type: string + tags: + type: object + since: + type: string + until: + type: string + cardId: + type: string + excludeFees: + type: boolean + status: + enum: + - Authorized + - Completed + - Canceled + - Declined + type: string + type: + items: + type: string + type: array + direction: + items: + enum: + - Debit + - Credit + type: string + type: array + fromAmount: + type: integer + toAmount: + type: integer + accountType: + type: string + type: object + UnitTransactionsListResponse: + properties: + data: + items: + $ref: '#/components/schemas/transaction' + type: array + included: + items: + $ref: '#/components/schemas/IncludedResource_inner' + type: array + title: UnitTransactionsListResponse + type: object + execute_filter_parameter_17: + properties: + query: + type: string + type: object + UnitDisputeResponse: + properties: + data: + $ref: '#/components/schemas/dispute' + title: UnitDisputeResponse + type: object + execute_filter_parameter_18: + properties: + accountId: + type: string + creditAccountId: + type: string + customerId: + type: string + status: + items: + enum: + - Pending + - PendingReview + - Returned + - Sent + - Rejected + type: string + type: array + type: + items: + enum: + - AchRepayment + - BookRepayment + type: string + type: array + type: object + UnitRepaymentsListResponse: + properties: + data: + items: + $ref: '#/components/schemas/repayment' + type: array + meta: + $ref: '#/components/schemas/paginationMeta' + title: UnitRepaymentsListResponse + type: object + execute_request_18: + properties: + data: + $ref: '#/components/schemas/createRepayment' + type: object + execute_filter_parameter_19: + properties: + accountId: + type: string + customerId: + type: string + status: + items: + enum: + - New + - Pending + - Canceled + - Rejected + - InDelivery + - InProduction + - Delivered + - ReturnedToSender + - Pending + - Processed + - PendingReview + - MarkedForReturn + - Returned + type: string + type: array + tags: + additionalProperties: + type: string + type: object + since: + type: string + until: + type: string + fromAmount: + type: integer + toAmount: + type: integer + checkNumber: + type: string + type: object + execute_200_response_3: + properties: + data: + items: + $ref: '#/components/schemas/CheckPayment' + type: array + type: object + execute_request_19: + properties: + data: + $ref: '#/components/schemas/createCheckPayment' + type: object + execute_request_20_data: + properties: + type: + default: additionalVerification + type: string + type: object + execute_request_20: + properties: + data: + $ref: '#/components/schemas/execute_request_20_data' + type: object + execute_request_21_data_attributes: + properties: + reason: + $ref: '#/components/schemas/returnReason' + type: object + execute_request_21_data: + properties: + type: + default: checkPaymentReturn + type: string + attributes: + $ref: '#/components/schemas/execute_request_21_data_attributes' + type: object + execute_request_21: + properties: + data: + $ref: '#/components/schemas/execute_request_21_data' + type: object + execute_filter_parameter_20: + properties: + accountId: + type: string + customerId: + type: string + status: + items: + enum: + - Active + - Disabled + type: string + type: array + tags: + additionalProperties: + type: string + type: object + since: + type: string + until: + type: string + fromAmount: + type: integer + toAmount: + type: integer + checkNumber: + type: string + type: object + update_application_data: + oneOf: + - $ref: '#/components/schemas/patchBusinessApplication' + - $ref: '#/components/schemas/patchIndividualApplication' + - $ref: '#/components/schemas/patchTrustApplication' + patchBusinessApplication_attributes: + additionalProperties: false + properties: + officer: + $ref: '#/components/schemas/officer' + beneficialOwners: + items: + $ref: '#/components/schemas/beneficialOwner' + type: array + tags: + additionalProperties: false + maxProperties: 15 + type: object + annualRevenue: + $ref: '#/components/schemas/businessAnnualRevenue' + numberOfEmployees: + $ref: '#/components/schemas/businessNumberOfEmployees' + cashFlow: + $ref: '#/components/schemas/cashFlow' + yearOfIncorporation: + pattern: "^\\d{4}$" + type: string + countriesOfOperation: + items: + $ref: '#/components/schemas/country' + minItems: 1 + type: array + stockSymbol: + type: string + businessVertical: + $ref: '#/components/schemas/businessVertical' + type: object + patchIndividualApplication_attributes: + additionalProperties: false + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + annualRevenue: + $ref: '#/components/schemas/soleProprietorshipAnnualRevenue' + numberOfEmployees: + $ref: '#/components/schemas/soleProprietorshipNumberOfEmployees' + businessVertical: + $ref: '#/components/schemas/businessVertical' + website: + type: string + type: object + patchTrustApplication_attributes: + additionalProperties: false + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + type: object + IndividualApplication_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + status: + $ref: '#/components/schemas/applicationStatus' + message: + type: string + evaluationOutcome: + type: string + evaluationId: + type: string + evaluationEntityId: + type: string + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + type: object + dateOfBirth: + format: date + type: string + dba: + type: string + ein: + pattern: "^\\d{9}$" + type: string + ip: + type: string + soleProprietorship: + type: boolean + decisionMethod: + enum: + - Manually + - Automatically + type: string + decisionUserId: + type: string + decisionReason: + type: string + decisionDateTime: + format: date-time + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + riskRate: + enum: + - low + - medium + - high + type: string + evaluationFlags: + items: + type: string + type: array + evaluationScores: + type: object + ipLocationDetails: + type: object + phoneLocationDetails: + type: object + maskedSSN: + pattern: "^\\*{5}\\d{4}$" + type: string + maskedPassport: + type: string + maskedMatriculaConsular: + type: string + jwtSubject: + nullable: true + type: string + archived: + type: boolean + powerOfAttorneyAgent: + $ref: '#/components/schemas/powerOfAttorneyAgent' + industry: + $ref: '#/components/schemas/industry' + idTheftScore: + type: integer + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + annualRevenue: + $ref: '#/components/schemas/soleProprietorshipAnnualRevenue' + numberOfEmployees: + $ref: '#/components/schemas/soleProprietorshipNumberOfEmployees' + businessVertical: + $ref: '#/components/schemas/businessVertical' + website: + type: string + required: + - createdAt + - fullName + - status + type: object + example: null + documentsRelationship_data_inner: + additionalProperties: false + properties: + type: + default: document + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + type: object + documentsRelationship: + additionalProperties: false + properties: + data: + items: + $ref: '#/components/schemas/documentsRelationship_data_inner' + type: array + required: + - data + title: documentsRelationship + type: object + applicationRelationships_trustees_data_inner: + additionalProperties: false + properties: + type: + default: trustee + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + type: object + applicationRelationships_trustees: + properties: + data: + items: + $ref: '#/components/schemas/applicationRelationships_trustees_data_inner' + type: array + type: object + applicationRelationships_beneficiaries_data_inner: + additionalProperties: false + properties: + type: + default: beneficiary + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + type: object + applicationRelationships_beneficiaries: + properties: + data: + items: + $ref: '#/components/schemas/applicationRelationships_beneficiaries_data_inner' + type: array + type: object + applicationRelationships_beneficialOwners_data_inner: + additionalProperties: false + properties: + type: + default: beneficialOwner + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + type: object + applicationRelationships_beneficialOwners: + properties: + data: + items: + $ref: '#/components/schemas/applicationRelationships_beneficialOwners_data_inner' + type: array + type: object + BusinessApplication_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + status: + $ref: '#/components/schemas/applicationStatus' + message: + type: string + evaluationOutcome: + type: string + evaluationId: + type: string + evaluationEntityId: + type: string + name: + type: string + dba: + nullable: true + type: string + ein: + pattern: "^\\d{9}$" + type: string + entityType: + $ref: '#/components/schemas/entityType' + dateOfIncorporation: + format: date + type: string + stateOfIncorporation: + pattern: "^((A[LKSZR])|(C[AOT])|(D[EC])|(F[ML])|(G[AU])|(HI)|(I[DLNA])|(K[SY])|(LA)|(M[EHDAINSOT])|(N[EVHJMYCD])|(MP)|(O[HKR])|(P[WAR])|(RI)|(S[CD])|(T[NX])|(UT)|(V[TIA])|(W[AVIY]))$" + type: string + purpose: + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + contact: + $ref: '#/components/schemas/contact' + officer: + $ref: '#/components/schemas/officer_1' + ip: + type: string + website: + type: string + beneficialOwners: + items: + $ref: '#/components/schemas/beneficialOwner_1' + type: array + decisionMethod: + enum: + - Manually + - Automatically + type: string + decisionUserId: + type: string + decisionReason: + type: string + decisionDateTime: + format: date-time + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + riskRate: + enum: + - low + - medium + - high + type: string + evaluationFlags: + items: + type: string + type: array + ipLocationDetails: + type: object + phoneLocationDetails: + type: object + archived: + type: boolean + industry: + $ref: '#/components/schemas/industry' + annualRevenue: + $ref: '#/components/schemas/businessAnnualRevenue' + numberOfEmployees: + $ref: '#/components/schemas/businessNumberOfEmployees' + cashFlow: + $ref: '#/components/schemas/cashFlow' + yearOfIncorporation: + pattern: "^\\d{4}$" + type: string + countriesOfOperation: + items: + $ref: '#/components/schemas/country' + minItems: 1 + type: array + stockSymbol: + type: string + businessVertical: + $ref: '#/components/schemas/businessVertical' + required: + - beneficialOwners + - contact + - createdAt + - entityType + - name + - officer + - stateOfIncorporation + - status + type: object + example: null + TrustApplication_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + status: + $ref: '#/components/schemas/applicationStatus' + message: + type: string + evaluationOutcome: + type: string + evaluationId: + type: string + evaluationEntityId: + type: string + name: + type: string + dateOfIncorporation: + format: date + type: string + stateOfIncorporation: + pattern: "^((A[LKSZR])|(C[AOT])|(D[EC])|(F[ML])|(G[AU])|(HI)|(I[DLNA])|(K[SY])|(LA)|(M[EHDAINSOT])|(N[EVHJMYCD])|(MP)|(O[HKR])|(P[WAR])|(RI)|(S[CD])|(T[NX])|(UT)|(V[TIA])|(W[AVIY]))$" + type: string + revocability: + $ref: '#/components/schemas/revocability' + sourceOfFunds: + $ref: '#/components/schemas/sourceOfFunds' + taxId: + type: string + contact: + $ref: '#/components/schemas/trustContact' + trustees: + items: + $ref: '#/components/schemas/trustee' + type: array + grantor: + $ref: '#/components/schemas/grantor' + ip: + type: string + decisionMethod: + enum: + - Manually + - Automatically + type: string + decisionUserId: + type: string + decisionReason: + type: string + decisionDateTime: + format: date-time + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + riskRate: + enum: + - low + - medium + - high + type: string + evaluationFlags: + items: + type: string + type: array + ipLocationDetails: + type: object + phoneLocationDetails: + type: object + archived: + type: boolean + required: + - contact + - createdAt + - name + - stateOfIncorporation + - status + type: object + example: null + document_attributes: + additionalProperties: false + properties: + documentType: + type: string + status: + type: string + description: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + matriculaConsular: + type: string + name: + type: string + address: + $ref: '#/components/schemas/address' + dateOfIncorporation: + format: date + type: string + stateOfIncorporation: + type: string + dateOfBirth: + format: date + type: string + ein: + pattern: "^\\d{9}$" + type: string + reasonCode: + type: string + reason: + type: string + evaluationId: + type: string + frontDocumentId: + type: string + backDocumentId: + type: string + frontDocumentStoreId: + type: string + backDocumentStoreId: + type: string + required: + - status + type: object + paginationMeta_pagination: + example: + total: 1 + offset: 6 + limit: 0 + properties: + limit: + type: integer + offset: + type: integer + total: + type: integer + type: object + createApplication_data: + oneOf: + - $ref: '#/components/schemas/CreateIndividualApplication' + - $ref: '#/components/schemas/CreateSoleProprietorApplication' + - $ref: '#/components/schemas/CreateBusinessApplication' + - $ref: '#/components/schemas/CreateTrustApplication' + CreateIndividualApplication_attributes: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + nullable: true + pattern: "^\\d{9}|\\d{4}" + type: string + passport: + nullable: true + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + ip: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + deviceFingerprints: + items: + $ref: '#/components/schemas/deviceFingerprint' + maxItems: 1 + type: array + jwtSubject: + nullable: true + type: string + powerOfAttorneyAgent: + $ref: '#/components/schemas/createPowerOfAttorneyAgent' + industry: + $ref: '#/components/schemas/industry' + evaluationParams: + $ref: '#/components/schemas/evaluationParams' + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + required: + - address + - dateOfBirth + - email + - fullName + - phone + type: object + CreateSoleProprietorApplication_attributes: + additionalProperties: false + properties: + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + nullable: true + pattern: "^\\d{9}|\\d{4}" + type: string + passport: + nullable: true + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + nullable: true + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + dba: + nullable: true + type: string + ein: + nullable: true + pattern: "^\\d{9}$" + type: string + ip: + type: string + soleProprietorship: + default: false + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + deviceFingerprints: + items: + $ref: '#/components/schemas/deviceFingerprint' + maxItems: 1 + type: array + jwtSubject: + nullable: true + type: string + powerOfAttorneyAgent: + $ref: '#/components/schemas/createPowerOfAttorneyAgent' + industry: + $ref: '#/components/schemas/industry' + evaluationParams: + $ref: '#/components/schemas/evaluationParams' + occupation: + $ref: '#/components/schemas/occupation' + annualIncome: + $ref: '#/components/schemas/annualIncome' + sourceOfIncome: + $ref: '#/components/schemas/sourceOfIncome' + annualRevenue: + $ref: '#/components/schemas/soleProprietorshipAnnualRevenue' + numberOfEmployees: + $ref: '#/components/schemas/soleProprietorshipNumberOfEmployees' + businessVertical: + $ref: '#/components/schemas/businessVertical' + website: + type: string + required: + - address + - dateOfBirth + - email + - fullName + - phone + type: object + CreateBusinessApplication_attributes: + additionalProperties: false + properties: + name: + maxLength: 255 + minLength: 1 + type: string + dba: + maxLength: 255 + minLength: 1 + type: string + ein: + pattern: "^\\d{9}$" + type: string + entityType: + $ref: '#/components/schemas/entityType' + dateOfIncorporation: + format: date + type: string + stateOfIncorporation: + maxLength: 2 + minLength: 2 + type: string + purpose: + maxLength: 1024 + minLength: 1 + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + contact: + $ref: '#/components/schemas/contact' + officer: + $ref: '#/components/schemas/createOfficer' + ip: + type: string + website: + type: string + beneficialOwners: + items: + $ref: '#/components/schemas/createBeneficialOwner' + type: array + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + deviceFingerprints: + items: + $ref: '#/components/schemas/deviceFingerprint' + maxItems: 1 + type: array + industry: + $ref: '#/components/schemas/industry' + annualRevenue: + $ref: '#/components/schemas/businessAnnualRevenue' + numberOfEmployees: + $ref: '#/components/schemas/businessNumberOfEmployees' + cashFlow: + $ref: '#/components/schemas/cashFlow' + yearOfIncorporation: + pattern: "^\\d{4}$" + type: string + countriesOfOperation: + items: + $ref: '#/components/schemas/country' + minItems: 1 + type: array + stockSymbol: + maxLength: 5 + minLength: 1 + type: string + businessVertical: + $ref: '#/components/schemas/businessVertical' + required: + - address + - beneficialOwners + - contact + - ein + - entityType + - name + - officer + - phone + - stateOfIncorporation + type: object + CreateTrustApplication_attributes: + additionalProperties: false + properties: + name: + maxLength: 255 + minLength: 1 + type: string + stateOfIncorporation: + maxLength: 2 + minLength: 2 + type: string + revocability: + enum: + - Revocable + - Irrevocable + type: string + sourceOfFunds: + enum: + - Inheritance + - Salary + - Savings + - InvestmentReturns + - Gifts + type: string + taxId: + type: string + grantor: + $ref: '#/components/schemas/grantor' + trustees: + items: + $ref: '#/components/schemas/trustee' + type: array + beneficiaries: + items: + $ref: '#/components/schemas/beneficiary' + type: array + contact: + $ref: '#/components/schemas/trustContact' + ip: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + deviceFingerprints: + items: + $ref: '#/components/schemas/deviceFingerprint' + maxItems: 1 + type: array + required: + - beneficiaries + - contact + - grantor + - name + - revocability + - sourceOfFunds + - stateOfIncorporation + - taxId + - trustees + type: object + application_form_attributes: + additionalProperties: false + properties: + email: + format: email + type: string + url: + type: string + stage: + type: string + applicantDetails: + $ref: '#/components/schemas/prefilled' + settingsOverride: + $ref: '#/components/schemas/settingsOverride' + tags: + additionalProperties: false + maxProperties: 15 + type: object + allowedApplicationTypes: + items: + enum: + - Individual + - Business + - SoleProprietorship + type: string + type: array + required: + - url + type: object + applicationFormRelationships_application_data: + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + enum: + - application + type: string + type: object + applicationFormRelationships_application: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/applicationFormRelationships_application_data' + type: object + createApplicationForm_attributes: + additionalProperties: false + properties: + email: + format: email + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + applicantDetails: + $ref: '#/components/schemas/prefilled' + settingsOverride: + $ref: '#/components/schemas/settingsOverride' + requireIdVerification: + $ref: '#/components/schemas/requireIdVerification' + allowedApplicationTypes: + items: + enum: + - Individual + - Business + - SoleProprietorship + type: string + type: array + lang: + enum: + - en + - es + type: string + hideApplicationProgressTracker: + type: boolean + type: object + createApplicationFormRelationships: + additionalProperties: false + properties: + application: + $ref: '#/components/schemas/Relationship' + title: createApplicationFormRelationships + type: object + DepositAccount_allOf_attributes_secondaryAccountNumber: + properties: + routingNumber: + pattern: "^\\d{9}$" + type: string + accountNumber: + pattern: "^\\d{10,12}$" + type: string + required: + - accountNumber + - routingNumber + type: object + example: null + DepositAccount_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + name: + type: string + depositProduct: + type: string + routingNumber: + pattern: "^\\d{9}$" + type: string + accountNumber: + pattern: "^\\d{10,12}$" + type: string + secondaryAccountNumber: + $ref: '#/components/schemas/DepositAccount_allOf_attributes_secondaryAccountNumber' + currency: + default: USD + type: string + balance: + type: integer + overdraftLimit: + minimum: 0 + type: integer + hold: + type: integer + available: + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + status: + enum: + - Open + - Closed + - Frozen + type: string + closeReason: + enum: + - ByCustomer + - Fraud + type: string + fraudReason: + enum: + - ACHActivity + - CardActivity + - CheckActivity + - ApplicationHistory + - AccountActivity + - ClientIdentified + - IdentityTheft + - LinkedToFraudulentCustomer + type: string + closeReasonText: + maxLength: 255 + type: string + freezeReason: + type: string + maskedAccountNumber: + pattern: "^\\*{6,8}\\d{4}$" + type: string + isOverdrawnWithinLimit: + type: boolean + dacaStatus: + enum: + - Activated + - Entered + type: string + updatedAt: + format: date-time + type: string + required: + - available + - balance + - createdAt + - currency + - depositProduct + - hold + - name + - routingNumber + - status + - tags + type: object + example: null + depositAccountRelationships: + additionalProperties: true + properties: + customer: + $ref: '#/components/schemas/customerLinkage' + title: depositAccountRelationships + type: object + CreditAccount_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + name: + type: string + creditTerms: + type: string + currency: + default: USD + type: string + balance: + type: integer + hold: + type: integer + available: + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + status: + enum: + - Open + - Closed + - Frozen + type: string + closeReason: + enum: + - ByCustomer + - Fraud + - Overdue + type: string + fraudReason: + enum: + - ACHActivity + - CardActivity + - CheckActivity + - ApplicationHistory + - AccountActivity + - ClientIdentified + - IdentityTheft + - LinkedToFraudulentCustomer + type: string + closeReasonText: + maxLength: 255 + type: string + freezeReason: + type: string + creditLimit: + minimum: 0 + type: integer + updatedAt: + format: date-time + type: string + required: + - available + - balance + - createdAt + - creditLimit + - creditTerms + - currency + - hold + - name + - status + - tags + type: object + example: null + creditAccountRelationships: + properties: + customer: + $ref: '#/components/schemas/customerLinkage' + required: + - customer + title: creditAccountRelationships + type: object + example: null + IndividualCustomer_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + fullName: + $ref: '#/components/schemas/fullName' + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + matriculaConsular: + type: string + address: + $ref: '#/components/schemas/address' + dateOfBirth: + format: date + type: string + ein: + type: string + dba: + type: string + soleProprietorship: + default: false + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + riskRate: + enum: + - low + - medium + - high + type: string + maskedSSN: + pattern: "^\\*{5}\\d{4}$" + type: string + maskedPassport: + type: string + maskedMatriculaConsular: + type: string + authorizedUsers: + items: + $ref: '#/components/schemas/authorizedUser' + type: array + jwtSubject: + nullable: true + type: string + status: + enum: + - Active + - Archived + type: string + archiveReason: + enum: + - Inactive + - FraudACHActivity + - FraudCardActivity + - FraudCheckActivity + - FraudApplicationHistory + - FraudAccountActivity + - FraudClientIdentified + - FraudLinkedToFraudulentCustomer + type: string + required: + - createdAt + - fullName + - status + type: object + example: null + BusinessCustomer_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + name: + type: string + dba: + type: string + ein: + pattern: "^\\d{9}$" + type: string + entityType: + $ref: '#/components/schemas/entityType' + dateOfIncorporation: + format: date + type: string + stateOfIncorporation: + type: string + purpose: + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + contact: + $ref: '#/components/schemas/contact' + tags: + additionalProperties: false + maxProperties: 15 + type: object + riskRate: + enum: + - low + - medium + - high + type: string + authorizedUsers: + items: + $ref: '#/components/schemas/authorizedUser' + type: array + status: + enum: + - Active + - Archived + type: string + archiveReason: + enum: + - Inactive + - FraudACHActivity + - FraudCardActivity + - FraudCheckActivity + - FraudApplicationHistory + - FraudAccountActivity + - FraudClientIdentified + - FraudLinkedToFraudulentCustomer + type: string + required: + - contact + - entityType + - name + - stateOfIncorporation + - status + type: object + example: null + TrustCustomer_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + name: + type: string + stateOfIncorporation: + type: string + contact: + $ref: '#/components/schemas/trustContact' + tags: + additionalProperties: false + maxProperties: 15 + type: object + revocability: + $ref: '#/components/schemas/revocability' + sourceOfFunds: + $ref: '#/components/schemas/sourceOfFunds' + taxId: + type: string + riskRate: + enum: + - low + - medium + - high + type: string + authorizedUsers: + items: + $ref: '#/components/schemas/authorizedUser' + type: array + status: + enum: + - Active + - Archived + type: string + archiveReason: + enum: + - Inactive + - FraudACHActivity + - FraudCardActivity + - FraudCheckActivity + - FraudApplicationHistory + - FraudAccountActivity + - FraudClientIdentified + - FraudLinkedToFraudulentCustomer + type: string + required: + - contact + - name + - stateOfIncorporation + - status + type: object + example: null + createAccount_data: + oneOf: + - $ref: '#/components/schemas/CreateCreditAccount' + - $ref: '#/components/schemas/CreateDepositAccount' + CreateCreditAccount_attributes: + additionalProperties: false + properties: + creditTerms: + type: string + creditLimit: + type: integer + tags: + nullable: true + type: object + idempotencyKey: + nullable: true + type: string + required: + - creditLimit + - creditTerms + type: object + CreateCreditAccount_relationships: + properties: + customer: + $ref: '#/components/schemas/customerLinkage' + type: object + CreateDepositAccount_attributes: + additionalProperties: false + properties: + depositProduct: + type: string + tags: + nullable: true + type: object + idempotencyKey: + nullable: true + type: string + required: + - depositProduct + type: object + CreateDepositAccount_relationships: + properties: + customer: + $ref: '#/components/schemas/customerLinkage' + customers: + $ref: '#/components/schemas/customersRelationship' + type: object + patch_account_data: + oneOf: + - $ref: '#/components/schemas/updateDepositAccount' + - $ref: '#/components/schemas/updateCreditAccount' + updateDepositAccount_attributes: + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + depositProduct: + type: string + name: + type: string + overdraftLimit: + minimum: 0 + type: integer + type: object + updateCreditAccount_attributes: + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + name: + type: string + type: object + limits_attributes_card_limits: + properties: + dailyWithdrawal: + type: number + dailyDeposit: + type: number + dailyPurchase: + type: number + dailyCardTransaction: + type: number + type: object + limits_attributes_card_totalsDaily: + properties: + withdrawal: + type: number + deposit: + type: number + purchase: + type: number + cardTransaction: + type: number + type: object + limits_attributes_card: + properties: + limits: + $ref: '#/components/schemas/limits_attributes_card_limits' + totalsDaily: + $ref: '#/components/schemas/limits_attributes_card_totalsDaily' + type: object + limits_attributes: + properties: + card: + $ref: '#/components/schemas/limits_attributes_card' + type: object + freezeAccountRequest_attributes: + properties: + reason: + enum: + - Fraud + - Other + type: string + reasonText: + nullable: true + type: string + type: object + closeAccountRequest_attributes: + properties: + reason: + default: ByCustomer + enum: + - ByCustomer + - Fraud + type: string + fraudReason: + enum: + - ACHActivity + - CardActivity + - CheckActivity + - ApplicationHistory + - AccountActivity + - ClientIdentified + - IdentityTheft + - LinkedToFraudulentCustomer + nullable: true + type: string + type: object + account_end_of_day_attributes: + additionalProperties: false + properties: + date: + format: date + type: string + balance: + type: integer + hold: + type: integer + available: + type: integer + overdraftLimit: + type: integer + required: + - available + - balance + - date + - hold + type: object + relationships_customer_data: + additionalProperties: false + properties: + type: + default: customer + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + relationships_customer: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/relationships_customer_data' + required: + - data + type: object + relationships_account_data: + additionalProperties: false + properties: + type: + default: account + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + relationships_account: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/relationships_account_data' + required: + - data + type: object + update_customer_data: + oneOf: + - $ref: '#/components/schemas/updateIndividualCustomer' + - $ref: '#/components/schemas/updateBusinessCustomer' + - $ref: '#/components/schemas/updateTrustCustomer' + updateIndividualCustomer_attributes: + additionalProperties: false + properties: + email: + format: email + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + dba: + nullable: true + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + authorizedUsers: + items: + $ref: '#/components/schemas/authorizedUser' + nullable: true + type: array + jwtSubject: + nullable: true + type: string + type: object + updateBusinessCustomer_attributes: + additionalProperties: false + properties: + dba: + nullable: true + type: string + ein: + pattern: "^\\d{9}$" + type: string + phone: + $ref: '#/components/schemas/phone' + address: + $ref: '#/components/schemas/address' + contact: + $ref: '#/components/schemas/responseContact' + tags: + additionalProperties: false + maxProperties: 15 + type: object + authorizedUsers: + items: + $ref: '#/components/schemas/authorizedUser' + nullable: true + type: array + type: object + updateTrustCustomer_attributes: + additionalProperties: false + properties: + contact: + $ref: '#/components/schemas/trustContact' + tags: + additionalProperties: false + maxProperties: 15 + type: object + authorizedUsers: + items: + $ref: '#/components/schemas/authorizedUser' + nullable: true + type: array + type: object + AchPayment_allOf_attributes: + additionalProperties: true + properties: + createdAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + direction: + enum: + - Credit + - Debit + type: string + description: + maxLength: 50 + minLength: 1 + type: string + addenda: + maxLength: 80 + minLength: 1 + type: string + counterparty: + $ref: '#/components/schemas/counterparty' + tags: + additionalProperties: false + maxProperties: 15 + type: object + status: + enum: + - Pending + - Rejected + - Clearing + - Sent + - Canceled + - Returned + type: string + settlementDate: + format: date + type: string + reason: + type: string + expectedCompletionDate: + format: date + type: string + secCode: + type: string + traceNumber: + type: string + sameDay: + type: boolean + counterpartyVerificationMethod: + type: string + clearingDaysOverride: + type: integer + required: + - amount + - createdAt + - description + - direction + - status + type: object + paymentRelationships_customers_data_inner: + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + default: org + type: string + type: object + paymentRelationships_customers: + properties: + data: + items: + $ref: '#/components/schemas/paymentRelationships_customers_data_inner' + type: array + type: object + BookPayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + direction: + enum: + - Credit + - Debit + type: string + description: + maxLength: 80 + minLength: 1 + type: string + status: + enum: + - Pending + - Rejected + - Clearing + - Sent + - Canceled + - Returned + type: string + transactionSummaryOverride: + type: string + reason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - createdAt + - description + - direction + - status + type: object + example: null + WirePayment_allOf_attributes_imadOmad: + properties: + imad: + type: string + omad: + type: string + type: object + example: null + WirePayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + direction: + enum: + - Credit + type: string + description: + maxLength: 50 + minLength: 1 + type: string + counterparty: + $ref: '#/components/schemas/wireCounterparty' + status: + enum: + - Pending + - Rejected + - Clearing + - Sent + - Canceled + - Returned + type: string + settlementDate: + format: date + type: string + reason: + type: string + imadOmad: + $ref: '#/components/schemas/WirePayment_allOf_attributes_imadOmad' + required: + - amount + - createdAt + - description + - direction + - status + type: object + example: null + BillPayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + direction: + enum: + - Credit + - Debit + type: string + description: + maxLength: 50 + minLength: 1 + type: string + status: + enum: + - Initialized + - Pending + - Rejected + - Clearing + - Sent + - Canceled + - Returned + type: string + reason: + type: string + required: + - amount + - createdAt + - description + - direction + - status + type: object + example: null + IncludedResource_inner: + properties: + id: + type: string + type: + type: string + attributes: + type: object + relationships: + type: object + type: object + CreateAchPayment_attributes: + additionalProperties: false + properties: + amount: + type: integer + description: + type: string + addenda: + type: string + direction: + enum: + - Debit + - Credit + type: string + counterparty: + $ref: '#/components/schemas/counterparty' + idempotencyKey: + type: string + sameDay: + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + secCode: + enum: + - WEB + - CCD + - PPD + type: string + required: + - amount + - counterparty + - description + - direction + type: object + CreateAchPayment_relationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/accountRelationship' + required: + - account + type: object + accountRelationship_data: + additionalProperties: false + properties: + type: + enum: + - account + - depositAccount + - creditAccount + - batchAccount + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + CreateAchPaymentCounterparty_attributes: + additionalProperties: false + properties: + amount: + type: integer + description: + type: string + addenda: + type: string + direction: + enum: + - Debit + - Credit + type: string + sameDay: + type: boolean + idempotencyKey: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + verifyCounterpartyBalance: + default: false + type: boolean + secCode: + enum: + - WEB + - CCD + - PPD + type: string + required: + - amount + - description + - direction + type: object + CreateAchPaymentCounterparty_relationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/accountRelationship' + counterparty: + $ref: '#/components/schemas/counterpartyRelationship' + required: + - account + - counterparty + type: object + counterpartyRelationship_data: + additionalProperties: false + properties: + type: + enum: + - account + - depositAccount + - counterparty + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + CreateAchPaymentPlaid_attributes: + additionalProperties: false + properties: + amount: + type: integer + description: + type: string + addenda: + type: string + direction: + enum: + - Debit + - Credit + type: string + idempotencyKey: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + plaidProcessorToken: + pattern: ^processor-.*$ + type: string + counterpartyName: + type: string + sameDay: + type: boolean + verifyCounterpartyBalance: + default: false + type: boolean + secCode: + enum: + - WEB + - CCD + - PPD + type: string + required: + - amount + - description + - direction + - plaidProcessorToken + type: object + CreateBookPayment_attributes: + additionalProperties: false + properties: + amount: + type: integer + description: + type: string + idempotencyKey: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + transactionSummaryOverride: + type: string + required: + - amount + - description + type: object + CreateBookPayment_relationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/accountRelationship' + counterpartyAccount: + $ref: '#/components/schemas/counterpartyAccountRelationship' + required: + - account + - counterpartyAccount + type: object + counterpartyAccountRelationship_data: + additionalProperties: false + properties: + type: + enum: + - account + - depositAccount + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + CreateWirePayment_attributes: + additionalProperties: false + properties: + amount: + type: integer + direction: + enum: + - Credit + type: string + description: + type: string + counterparty: + $ref: '#/components/schemas/wireCounterparty' + idempotencyKey: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - counterparty + - description + type: object + CreateBillPayment_attributes: + additionalProperties: false + properties: + billerId: + type: string + accountNumber: + type: string + amount: + type: integer + description: + type: string + idempotencyKey: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + fullName: + $ref: '#/components/schemas/fullName' + dateOfBirth: + format: date + type: string + required: + - accountNumber + - amount + - billerId + - description + type: object + CreatePushToCardPayment_attributes_configuration: + properties: + astra: + $ref: '#/components/schemas/astra' + type: object + CreatePushToCardPayment_attributes: + additionalProperties: false + properties: + amount: + type: integer + idempotencyKey: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + description: + type: string + configuration: + $ref: '#/components/schemas/CreatePushToCardPayment_attributes_configuration' + required: + - amount + - configuration + - description + type: object + update_payment_data: + oneOf: + - $ref: '#/components/schemas/patchAchPayment' + - $ref: '#/components/schemas/patchBookPayment' + received_payment_attributes: + properties: + createdAt: + format: date-time + type: string + status: + enum: + - Pending + - Advanced + - Completed + - Returned + type: string + amount: + minimum: 1 + type: integer + completionDate: + type: string + direction: + enum: + - Debit + - Credit + type: string + wasAdvanced: + type: boolean + isAdvanceable: + type: boolean + isAdvaceable: + type: boolean + companyName: + type: string + counterpartyRoutingNumber: + type: string + description: + type: string + addenda: + type: string + traceNumber: + type: string + secCode: + maxLength: 3 + minLength: 3 + type: string + returnReason: + type: string + receivingEntityName: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - companyName + - completionDate + - counterpartyRoutingNumber + - createdAt + - description + - direction + - secCode + - status + - traceNumber + - wasAdvanced + type: object + receivedPaymentRelationships_customer_data: + additionalProperties: false + example: + id: id + type: businessCustomer + properties: + type: + enum: + - businessCustomer + - individualCustomer + - customer + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + receivedPaymentRelationships_customer: + additionalProperties: false + example: + data: + id: id + type: businessCustomer + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_customer_data' + required: + - data + type: object + receivedPaymentRelationships_receivePaymentTransaction_data: + additionalProperties: false + properties: + type: + default: transaction + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + receivedPaymentRelationships_receivePaymentTransaction: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction_data' + required: + - data + type: object + update_received_payment_data: + oneOf: + - $ref: '#/components/schemas/patchAchReceivedPayment' + counterparty_1_attributes: + additionalProperties: false + properties: + routingNumber: + pattern: "^\\d{9}$" + type: string + accountNumber: + pattern: "^\\d{1,17}$" + type: string + accountType: + enum: + - Checking + - Savings + - Loan + type: string + type: + enum: + - Business + - Person + - Unknown + type: string + name: + maxLength: 50 + minLength: 1 + type: string + bank: + type: string + permissions: + enum: + - CreditOnly + - DebitOnly + - CreditAndDebit + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + createdAt: + format: date-time + type: string + required: + - accountNumber + - accountType + - createdAt + - name + - permissions + - routingNumber + - type + type: object + CreateAchCounterparty_attributes: + additionalProperties: false + properties: + routingNumber: + type: string + accountNumber: + type: string + accountType: + enum: + - Checking + - Savings + - Loan + type: string + permissions: + enum: + - CreditOnly + - DebitOnly + - CreditAndDebit + type: string + type: + enum: + - Business + - Person + - Unknown + type: string + name: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + type: string + required: + - accountNumber + - accountType + - name + - routingNumber + - type + type: object + CreatePlaidCounterparty_attributes: + additionalProperties: false + properties: + type: + enum: + - Business + - Person + - Unknown + type: string + name: + type: string + verifyName: + default: false + type: boolean + plaidProcessorToken: + maxLength: 60 + minLength: 40 + pattern: ^processor-.*$ + type: string + permissions: + enum: + - CreditOnly + - DebitOnly + - CreditAndDebit + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + type: string + required: + - plaidProcessorToken + - type + type: object + update_counterparty_data: + oneOf: + - $ref: '#/components/schemas/patchCounterparty' + patchCounterparty_attributes: + additionalProperties: false + properties: + plaidProcessorToken: + maxLength: 60 + minLength: 40 + pattern: ^processor-.*$ + type: string + name: + maxLength: 50 + minLength: 1 + type: string + permissions: + enum: + - CreditOnly + - DebitOnly + - CreditAndDebit + type: string + verifyName: + default: false + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + type: object + counterparty_balance_attributes: + additionalProperties: false + properties: + balance: + type: number + available: + type: number + required: + - balance + type: object + counterpartyBalanceRelationships_counterparty_data: + additionalProperties: false + properties: + type: + default: counterparty + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + counterpartyBalanceRelationships_counterparty: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/counterpartyBalanceRelationships_counterparty_data' + required: + - data + type: object + RecurringCreditAchPayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + description: + maxLength: 10 + minLength: 1 + type: string + addenda: + maxLength: 80 + minLength: 1 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + status: + enum: + - Pending + - Active + - Completed + - Disabled + type: string + schedule: + $ref: '#/components/schemas/schedule' + numberOfPayments: + type: integer + required: + - amount + - createdAt + - description + - numberOfPayments + - schedule + - status + type: object + example: null + recurringAchPaymentRelationships_account_data: + additionalProperties: false + example: + id: id + type: depositAccount + properties: + type: + enum: + - depositAccount + - account + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + recurringAchPaymentRelationships_account: + additionalProperties: false + example: + data: + id: id + type: depositAccount + properties: + data: + $ref: '#/components/schemas/recurringAchPaymentRelationships_account_data' + required: + - data + type: object + recurringAchPaymentRelationships_counterparty_data: + additionalProperties: false + properties: + type: + enum: + - account + - counterparty + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + recurringAchPaymentRelationships_counterparty: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/recurringAchPaymentRelationships_counterparty_data' + required: + - data + type: object + recurringAchPaymentRelationships_org_data: + additionalProperties: false + properties: + type: + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + recurringAchPaymentRelationships_org: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/recurringAchPaymentRelationships_org_data' + required: + - data + type: object + RecurringDebitAchPayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + description: + maxLength: 10 + minLength: 1 + type: string + addenda: + maxLength: 80 + minLength: 1 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + status: + enum: + - Pending + - Active + - Completed + - Disabled + type: string + schedule: + $ref: '#/components/schemas/schedule' + numberOfPayments: + type: integer + verifyCounterpartyBalance: + default: false + type: boolean + sameDay: + default: false + type: boolean + required: + - amount + - createdAt + - description + - numberOfPayments + - schedule + - status + type: object + example: null + RecurringCreditBookPayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + description: + maxLength: 80 + minLength: 1 + type: string + status: + enum: + - Pending + - Active + - Completed + - Disabled + type: string + schedule: + $ref: '#/components/schemas/schedule' + numberOfPayments: + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - createdAt + - description + - numberOfPayments + - schedule + - status + - updatedAt + type: object + example: null + recurringBookPaymentRelationships_counterpartyAccount_data: + additionalProperties: false + properties: + type: + enum: + - account + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + recurringBookPaymentRelationships_counterpartyAccount: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/recurringBookPaymentRelationships_counterpartyAccount_data' + required: + - data + type: object + BusinessDebitCard_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + last4Digits: + pattern: "^\\d{4}$" + type: string + expirationDate: + pattern: "^\\d{4}[-](1[012]|0[1-9])$" + type: string + shippingAddress: + $ref: '#/components/schemas/address' + address: + $ref: '#/components/schemas/address' + fullName: + $ref: '#/components/schemas/fullName' + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + dateOfBirth: + format: date + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + bin: + pattern: "^\\d{9}$" + type: string + status: + $ref: '#/components/schemas/physicalCardStatus' + design: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + freezeReason: + type: string + required: + - address + - createdAt + - dateOfBirth + - email + - expirationDate + - fullName + - last4Digits + - phone + type: object + example: null + cardRelationships_account: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/counterpartyAccountRelationship_data' + required: + - data + type: object + IndividualDebitCard_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + last4Digits: + pattern: "^\\d{4}$" + type: string + expirationDate: + pattern: "^\\d{4}[-](1[012]|0[1-9])$" + type: string + shippingAddress: + $ref: '#/components/schemas/address' + bin: + pattern: "^\\d{9}$" + type: string + status: + $ref: '#/components/schemas/physicalCardStatus' + design: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + freezeReason: + type: string + required: + - createdAt + - expirationDate + - last4Digits + - status + type: object + example: null + BusinessVirtualDebitCard_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + last4Digits: + pattern: "^\\d{4}$" + type: string + expirationDate: + pattern: "^\\d{4}[-](1[012]|0[1-9])$" + type: string + address: + $ref: '#/components/schemas/address' + fullName: + $ref: '#/components/schemas/fullName' + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + dateOfBirth: + format: date + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + bin: + pattern: "^\\d{9}$" + type: string + status: + $ref: '#/components/schemas/virtualCardStatus' + tags: + additionalProperties: false + maxProperties: 15 + type: object + freezeReason: + type: string + required: + - address + - createdAt + - dateOfBirth + - email + - expirationDate + - fullName + - last4Digits + - phone + type: object + example: null + IndividualVirtualDebitCard_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + last4Digits: + pattern: "^\\d{4}$" + type: string + expirationDate: + pattern: "^\\d{4}[-](1[012]|0[1-9])$" + type: string + bin: + pattern: "^\\d{9}$" + type: string + status: + $ref: '#/components/schemas/virtualCardStatus' + tags: + additionalProperties: false + maxProperties: 15 + type: object + freezeReason: + type: string + required: + - createdAt + - expirationDate + - last4Digits + - status + type: object + example: null + CreateIndividualDebitCard_attributes: + additionalProperties: false + properties: + shippingAddress: + $ref: '#/components/schemas/address' + design: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + bin: + $ref: '#/components/schemas/BIN' + cardQualifier: + pattern: "^(\\d{3})|([ ]{3})$" + type: string + cardDesignId: + maxLength: 16 + type: string + additionalEmbossedText: + maxLength: 26 + type: string + activeForOnlineUse: + type: boolean + printOnlyBusinessName: + type: boolean + expiryDate: + pattern: "^(1[0-2]|0[1-9])/(\\d{2})$|^(\\d{4})-(1[0-2]|0[1-9])$|^(\\d{2})-(1[0-2]|0[1-9])$" + type: string + type: object + CreateBusinessDebitCard_attributes: + additionalProperties: false + properties: + shippingAddress: + $ref: '#/components/schemas/address' + address: + $ref: '#/components/schemas/address' + fullName: + $ref: '#/components/schemas/fullName' + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + dateOfBirth: + format: date + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + design: + type: string + additionalEmbossedText: + maxLength: 26 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + activeForOnlineUse: + type: boolean + printOnlyBusinessName: + type: boolean + expiryDate: + pattern: "^(1[0-2]|0[1-9])/(\\d{2})$|^(\\d{4})-(1[0-2]|0[1-9])$|^(\\d{2})-(1[0-2]|0[1-9])$" + type: string + required: + - address + - dateOfBirth + - email + - fullName + - phone + type: object + CreateIndividualVirtualDebitCard_attributes: + additionalProperties: false + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + bin: + $ref: '#/components/schemas/BIN' + cardQualifier: + pattern: "^\\d{3}$" + type: string + expiryDate: + pattern: "^(1[0-2]|0[1-9])/(\\d{2})$|^(\\d{4})-(1[0-2]|0[1-9])$|^(\\d{2})-(1[0-2]|0[1-9])$" + type: string + type: object + CreateBusinessVirtualDebitCard_attributes: + additionalProperties: false + properties: + address: + $ref: '#/components/schemas/address' + fullName: + $ref: '#/components/schemas/fullName' + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + dateOfBirth: + format: date + type: string + nationality: + pattern: ^(A(D|E|F|G|I|L|M|N|O|R|S|T|Q|U|W|X|Z)|B(A|B|D|E|F|G|H|I|J|L|M|N|O|Q|R|S|T|V|W|Y|Z)|C(A|C|D|F|G|H|I|K|L|M|N|O|R|U|V|W|X|Y|Z)|D(E|J|K|M|O|Z)|E(C|E|G|H|R|S|T)|F(I|J|K|M|O|R)|G(A|B|D|E|F|G|H|I|L|M|N|P|Q|R|S|T|U|W|Y)|H(K|M|N|R|T|U)|I(D|E|Q|L|M|N|O|R|S|T)|J(E|M|O|P)|K(E|G|H|I|M|N|P|R|W|Y|Z)|L(A|B|C|I|K|R|S|T|U|V|Y)|M(A|C|D|E|F|G|H|K|L|M|N|O|Q|P|R|S|T|U|V|W|X|Y|Z)|N(A|C|E|F|G|I|L|O|P|R|U|Z)|OM|P(A|E|F|G|H|K|L|M|N|R|S|T|W|Y)|QA|R(E|O|S|U|W)|S(A|B|C|D|E|G|H|I|J|K|L|M|N|O|R|T|V|X|Y|Z)|T(C|D|F|G|H|J|K|L|M|N|O|R|T|V|W|Z)|U(A|G|M|S|Y|Z)|V(A|C|E|G|I|N|U)|W(F|S)|XK|Y(E|T)|Z(A|M|W))$ + type: string + ssn: + pattern: "^\\d{9}$" + type: string + passport: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + expiryDate: + pattern: "^(1[0-2]|0[1-9])/(\\d{2})$|^(\\d{4})-(1[0-2]|0[1-9])$|^(\\d{2})-(1[0-2]|0[1-9])$" + type: string + required: + - address + - dateOfBirth + - email + - fullName + - phone + type: object + update_card_data: + oneOf: + - $ref: '#/components/schemas/patchIndividualDebitCard' + - $ref: '#/components/schemas/patchIndividualVirtualDebitCard' + - $ref: '#/components/schemas/patchBusinessDebitCard' + - $ref: '#/components/schemas/patchBusinessVirtualDebitCard' + - $ref: '#/components/schemas/patchBusinessCreditCard' + - $ref: '#/components/schemas/patchBusinessVirtualCreditCard' + patchIndividualDebitCard_attributes: + additionalProperties: false + properties: + shippingAddress: + $ref: '#/components/schemas/address' + design: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + defaultFundingAccountId: + pattern: "^[1-9]\\d*$" + type: string + type: object + patchIndividualVirtualDebitCard_attributes: + additionalProperties: false + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + defaultFundingAccountId: + pattern: "^[1-9]\\d*$" + type: string + type: object + patchBusinessDebitCard_attributes: + additionalProperties: false + properties: + shippingAddress: + $ref: '#/components/schemas/address' + address: + $ref: '#/components/schemas/address' + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + design: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + defaultFundingAccountId: + pattern: "^[1-9]\\d*$" + type: string + type: object + patchBusinessVirtualDebitCard_attributes: + additionalProperties: false + properties: + address: + $ref: '#/components/schemas/address' + phone: + $ref: '#/components/schemas/phone' + email: + format: email + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + limits: + $ref: '#/components/schemas/cardLevelLimits' + defaultFundingAccountId: + pattern: "^[1-9]\\d*$" + type: string + type: object + pinStatus_attributes: + properties: + status: + type: string + type: object + DepositLimits_allOf_attributes_ach_limits: + properties: + dailyDebit: + type: number + dailyCredit: + type: number + monthlyDebit: + type: number + monthlyDebitSoft: + type: number + dailyDebitSoft: + type: number + monthlyCredit: + type: number + required: + - dailyCredit + - dailyDebit + - monthlyCredit + - monthlyDebit + type: object + example: null + DepositLimits_allOf_attributes_ach_totalsDaily: + properties: + debits: + type: number + credits: + type: number + required: + - credits + - debits + type: object + example: null + DepositLimits_allOf_attributes_ach: + properties: + limits: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_ach_limits' + totalsDaily: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_ach_totalsDaily' + totalsMonthly: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_ach_totalsDaily' + required: + - limits + - totalsDaily + - totalsMonthly + type: object + example: null + DepositLimits_allOf_attributes_card_limits: + properties: + dailyWithdrawal: + type: number + dailyDeposit: + type: number + dailyPurchase: + type: number + dailyCardTransaction: + type: number + required: + - dailyCardTransaction + - dailyDeposit + - dailyPurchase + - dailyWithdrawal + type: object + example: null + DepositLimits_allOf_attributes_card_totalsDaily: + properties: + withdrawals: + type: number + deposits: + type: number + purchases: + type: number + cardTransactions: + type: number + required: + - cardTransactions + - deposits + - purchases + - withdrawals + type: object + example: null + DepositLimits_allOf_attributes_card: + properties: + limits: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_card_limits' + totalsDaily: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_card_totalsDaily' + required: + - limits + - totalsDaily + type: object + example: null + DepositLimits_allOf_attributes_checkDeposit_limits: + properties: + daily: + type: number + monthly: + type: number + dailySoft: + type: number + monthlySoft: + type: number + required: + - daily + - dailySoft + - monthly + - monthlySoft + type: object + example: null + DepositLimits_allOf_attributes_checkDeposit: + properties: + limits: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_checkDeposit_limits' + totalsDaily: + type: number + totalsMonthly: + type: number + required: + - limits + - totalsDaily + - totalsMonthly + type: object + example: null + DepositLimits_allOf_attributes: + properties: + ach: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_ach' + card: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_card' + checkDeposit: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_checkDeposit' + required: + - ach + - card + - checkDeposit + type: object + example: null + CreditLimits_allOf_attributes: + properties: + card: + $ref: '#/components/schemas/DepositLimits_allOf_attributes_card' + required: + - card + type: object + example: null + authorization_attributes: + additionalProperties: false + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + cardLast4Digits: + type: string + merchant: + $ref: '#/components/schemas/merchant' + recurring: + type: boolean + status: + type: string + declineReason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + paymentMethod: + type: string + digitalWallet: + type: string + summary: + type: string + cardVerificationData: + $ref: '#/components/schemas/cardVerificationData' + cardNetwork: + type: string + cashWithdrawalAmount: + type: integer + required: + - amount + - cardLast4Digits + - createdAt + - merchant + - recurring + - status + type: object + PurchaseAuthorizationRequest_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + status: + type: string + partialApprovalAllowed: + type: boolean + approvedAmount: + type: integer + declineReason: + type: string + merchant: + $ref: '#/components/schemas/merchant' + recurring: + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + healthcareAmounts: + $ref: '#/components/schemas/healthcareAmounts' + paymentMethod: + type: string + digitalWallet: + type: string + cardVerificationData: + $ref: '#/components/schemas/cardVerificationData' + ecommerce: + type: boolean + cardPresent: + type: boolean + cardNetwork: + type: string + cashWithdrawalAmount: + type: integer + required: + - amount + - createdAt + - merchant + - partialApprovalAllowed + - recurring + - status + type: object + example: null + authorizationRequestRelationships_card_data: + additionalProperties: false + properties: + type: + default: card + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + authorizationRequestRelationships_card: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/authorizationRequestRelationships_card_data' + required: + - data + type: object + CardTransactionAuthorizationRequest_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + status: + type: string + partialApprovalAllowed: + type: boolean + approvedAmount: + type: integer + declineReason: + type: string + merchant: + $ref: '#/components/schemas/merchant' + recurring: + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + paymentMethod: + type: string + digitalWallet: + type: string + cardVerificationData: + $ref: '#/components/schemas/cardVerificationData' + cardNetwork: + type: string + required: + - amount + - createdAt + - merchant + - partialApprovalAllowed + - recurring + - status + type: object + example: null + AtmAuthorizationRequest_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + status: + type: string + partialApprovalAllowed: + type: boolean + approvedAmount: + type: integer + declineReason: + type: string + direction: + type: string + atmName: + type: string + atmLocation: + type: string + surcharge: + type: integer + internationalServiceFee: + nullable: true + type: number + tags: + additionalProperties: false + maxProperties: 15 + type: object + cardNetwork: + type: string + required: + - amount + - atmName + - createdAt + - direction + - partialApprovalAllowed + - status + - surcharge + type: object + example: null + approveAuthorizationRequest_attributes: + properties: + amount: + type: integer + fundingAccount: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + type: object + declineAuthorizationRequest_attributes: + properties: + reason: + enum: + - AccountClosed + - CardExceedsAmountLimit + - DoNotHonor + - InsufficientFunds + - InvalidMerchant + - ReferToCardIssuer + - RestrictedCard + - TransactionNotPermittedToCardholder + type: string + type: object + statement_attributes: + properties: + period: + type: string + type: object + reward_attributes: + additionalProperties: false + properties: + createdAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + description: + maxLength: 50 + type: string + status: + enum: + - Rejected + - Sent + type: string + rejectReason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - createdAt + - description + - status + - tags + type: object + transactionRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction_data' + required: + - data + title: transactionRelationship + type: object + cardRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/authorizationRequestRelationships_card_data' + required: + - data + title: cardRelationship + type: object + createReward_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + description: + maxLength: 50 + type: string + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - description + type: object + institution_attributes: + additionalProperties: false + properties: + routingNumber: + type: string + name: + type: string + address: + type: string + isWireSupported: + type: boolean + isACHSupported: + type: boolean + required: + - isACHSupported + - isWireSupported + - name + - routingNumber + type: object + createFee_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + description: + maxLength: 50 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + required: + - amount + - description + type: object + fee_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + description: + maxLength: 50 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - description + type: object + check_deposit_attributes: + additionalProperties: false + properties: + createdAt: + format: date-time + type: string + settlementDate: + format: date + type: string + amount: + minimum: 1 + type: integer + description: + maxLength: 50 + minLength: 1 + type: string + status: + enum: + - AwaitingImages + - AwaitingFrontImage + - AwaitingBackImage + - Pending + - PendingReview + - AwaitingCustomerConfirmation + - Rejected + - Clearing + - Sent + - Canceled + - Returned + type: string + reason: + nullable: true + type: string + statusCreatedAt: + format: date-time + type: string + statusSetBy: + type: string + statusHistory: + items: + $ref: '#/components/schemas/statusEvent' + type: array + reasonText: + type: string + checkNumber: + type: string + vendor: + type: string + counterparty: + $ref: '#/components/schemas/counterparty_2' + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - createdAt + - description + - status + type: object + statusEvent_status: + properties: + type: + $ref: '#/components/schemas/checkDepositStatus' + type: object + checkDepositRelationships_account_data: + additionalProperties: false + properties: + type: + enum: + - account + - depositAccount + - batchAccount + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + checkDepositRelationships_account: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/checkDepositRelationships_account_data' + required: + - data + type: object + createCheckDeposit_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + description: + maxLength: 50 + minLength: 1 + type: string + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - description + type: object + patchCheckDeposit_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + type: object + api_token_attributes: + additionalProperties: true + properties: + createdAt: + format: date-time + type: string + description: + type: string + expiration: + format: date-time + type: string + token: + type: string + sourceIp: + type: string + required: + - createdAt + type: object + createApiToken_attributes_resources_inner: + properties: + type: + enum: + - card + - account + type: string + ids: + items: + $ref: '#/components/schemas/identifier' + type: array + type: object + createApiToken_attributes: + additionalProperties: false + properties: + scope: + type: string + description: + type: string + expiration: + format: date-time + type: string + sourceIp: + type: string + resources: + items: + $ref: '#/components/schemas/createApiToken_attributes_resources_inner' + minItems: 1 + type: array + required: + - description + - expiration + type: object + createCustomerToken_attributes: + properties: + scope: + type: string + verificationToken: + type: string + jwtToken: + type: string + expiresIn: + type: integer + verificationCode: + type: string + resources: + items: + $ref: '#/components/schemas/createApiToken_attributes_resources_inner' + minItems: 1 + type: array + upgradableScope: + type: string + type: object + customer_token_attributes: + properties: + token: + type: string + expiresIn: + type: integer + type: object + createCustomerTokenVerification_attributes: + additionalProperties: false + properties: + channel: + enum: + - sms + - call + type: string + phone: + $ref: '#/components/schemas/phone' + appHash: + maxLength: 11 + minLength: 11 + type: string + language: + enum: + - en + - af + - ar + - ca + - zh + - zh-CN + - zh-HK + - hr + - cs + - da + - nl + - en-GB + - et + - fi + - fr + - de + - el + - he + - hi + - hu + - id + - it + - ja + - kn + - ko + - ms + - mr + - nb + - pl + - pt-BR + - pt + - ro + - ru + - sk + - es + - sv + - tl + - te + - th + - tr + - vi + type: string + required: + - channel + type: object + customer_token_verification_attributes: + properties: + verificationToken: + type: string + type: object + webhook_attributes: + properties: + createdAt: + format: date-time + type: string + lebel: + type: string + url: + type: string + status: + type: string + contentType: + enum: + - Json + - JsonAPI + type: string + deliveryMode: + enum: + - AtMostOnce + - AtLeastOnce + type: string + token: + type: string + type: object + updateUnitRequest_data_attributes: + properties: + tags: + type: object + type: object + updateUnitRequest_data: + properties: + type: + type: string + attributes: + $ref: '#/components/schemas/updateUnitRequest_data_attributes' + type: object + OriginatedAchTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + description: + type: string + addenda: + type: string + counterparty: + $ref: '#/components/schemas/counterparty' + tags: + additionalProperties: false + maxProperties: 15 + type: object + secCode: + type: string + traceNumber: + type: string + required: + - amount + - balance + - counterparty + - createdAt + - description + - direction + - summary + type: object + example: null + accountRelationship_2_data: + additionalProperties: false + properties: + type: + enum: + - depositAccount + - glAccount + - account + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + accountRelationship_2: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/accountRelationship_2_data' + required: + - data + title: accountRelationship + type: object + receivingAccountRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/recurringAchPaymentRelationships_account_data' + required: + - data + title: receivingAccountRelationship + type: object + customerRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_customer_data' + required: + - data + title: customerRelationship + type: object + counterpartyAccountRelationship_1: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/relationships_account_data' + required: + - data + title: counterpartyAccountRelationship + type: object + counterpartyCustomerRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/relationships_customer_data' + required: + - data + title: counterpartyCustomerRelationship + type: object + relatedTransactionRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction_data' + required: + - data + title: relatedTransactionRelationship + type: object + authorizationRelationship_data: + additionalProperties: false + properties: + type: + default: authorization + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + authorizationRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/authorizationRelationship_data' + required: + - data + title: authorizationRelationship + type: object + returnedRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction_data' + required: + - data + title: returnedRelationship + type: object + paymentRelationship_data: + additionalProperties: false + properties: + type: + default: payment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + paymentRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/paymentRelationship_data' + required: + - data + title: paymentRelationship + type: object + checkPaymentRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/paymentRelationship_data' + required: + - data + title: checkPaymentRelationship + type: object + repaymentRelationship_data: + additionalProperties: false + properties: + type: + default: repayment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + repaymentRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/repaymentRelationship_data' + required: + - data + title: repaymentRelationship + type: object + recurringPaymentRelationship_data: + additionalProperties: false + properties: + type: + default: recurringPayment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + recurringPaymentRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/recurringPaymentRelationship_data' + required: + - data + title: recurringPaymentRelationship + type: object + incomingAchRelationship_data: + additionalProperties: false + properties: + type: + default: incomingAch + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + incomingAchRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/incomingAchRelationship_data' + required: + - data + title: incomingAchRelationship + type: object + checkDepositRelationship_data: + additionalProperties: false + properties: + type: + default: checkDeposit + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + checkDepositRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/checkDepositRelationship_data' + required: + - data + title: checkDepositRelationship + type: object + authorizationRequestRelationship_data: + additionalProperties: false + properties: + type: + default: authorizationRequest + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + authorizationRequestRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/authorizationRequestRelationship_data' + required: + - data + title: authorizationRequestRelationship + type: object + receivedPaymentRelationship_data: + additionalProperties: false + properties: + type: + default: receivedPayment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + receivedPaymentRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/receivedPaymentRelationship_data' + required: + - data + title: receivedPaymentRelationship + type: object + chargebackRelationship_data: + additionalProperties: false + properties: + type: + default: chargeback + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + chargebackRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/chargebackRelationship_data' + required: + - data + title: chargebackRelationship + type: object + rewardRelationship_data: + additionalProperties: false + properties: + type: + default: reward + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + rewardRelationship: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/rewardRelationship_data' + required: + - id + - type + title: rewardRelationship + type: object + ReceivedAchTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + description: + type: string + addenda: + type: string + companyName: + type: string + counterpartyName: + type: string + counterpartyRoutingNumber: + type: string + traceNumber: + type: string + secCode: + maxLength: 3 + minLength: 3 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - companyName + - counterpartyRoutingNumber + - createdAt + - description + - direction + - summary + type: object + example: null + ReturnedAchTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + companyName: + type: string + counterpartyName: + type: string + counterpartyRoutingNumber: + type: string + reason: + type: string + achReason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - companyName + - counterpartyName + - counterpartyRoutingNumber + - createdAt + - direction + - reason + - summary + type: object + example: null + ReturnedReceivedAchTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + companyName: + type: string + reason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - companyName + - createdAt + - direction + - reason + - summary + type: object + example: null + DishonoredAchTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + description: + type: string + companyName: + type: string + counterpartyName: + type: string + counterpartyRoutingNumber: + type: string + traceNumber: + type: string + reason: + type: string + secCode: + maxLength: 3 + minLength: 3 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - companyName + - counterpartyRoutingNumber + - createdAt + - description + - direction + - summary + type: object + example: null + PurchaseTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + cardLast4Digits: + type: string + merchant: + $ref: '#/components/schemas/merchant' + coordinates: + $ref: '#/components/schemas/coordinates' + recurring: + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + networkTransactionId: + type: string + interchange: + nullable: true + type: string + ecommerce: + type: boolean + cardPresent: + type: boolean + internationalServiceFee: + nullable: true + type: integer + paymentMethod: + type: string + digitalWallet: + type: string + cardVerificationData: + $ref: '#/components/schemas/cardVerificationData' + cardNetwork: + type: string + required: + - amount + - balance + - cardLast4Digits + - cardPresent + - createdAt + - direction + - ecommerce + - merchant + - recurring + - summary + type: object + example: null + BookTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + counterparty: + $ref: '#/components/schemas/counterparty' + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - counterparty + - createdAt + - direction + - summary + type: object + example: null + AtmTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + cardLast4Digits: + type: string + atmName: + type: string + atmLocation: + type: string + surcharge: + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + networkTransactionId: + type: string + interchange: + nullable: true + type: string + internationalServiceFee: + nullable: true + type: integer + cardNetwork: + type: string + required: + - amount + - atmName + - balance + - cardLast4Digits + - createdAt + - direction + - summary + - surcharge + type: object + example: null + FeeTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - summary + type: object + example: null + ReversalTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + cardLast4Digits: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + networkTransactionId: + type: string + internationalServiceFee: + nullable: true + type: integer + required: + - amount + - balance + - cardLast4Digits + - createdAt + - direction + - summary + type: object + example: null + CardTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + cardLast4Digits: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + networkTransactionId: + type: string + interchange: + nullable: true + type: string + internationalServiceFee: + nullable: true + type: integer + merchant: + $ref: '#/components/schemas/merchant' + recurring: + type: boolean + paymentMethod: + type: string + digitalWallet: + type: string + cardVerificationData: + $ref: '#/components/schemas/cardVerificationData' + cardNetwork: + type: string + required: + - amount + - balance + - cardLast4Digits + - createdAt + - direction + - merchant + - recurring + - summary + type: object + example: null + ReleaseTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + senderName: + type: string + description: + type: string + senderAccountNumber: + maxLength: 17 + type: string + senderAddress: + $ref: '#/components/schemas/address' + counterparty: + $ref: '#/components/schemas/counterparty' + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - counterparty + - createdAt + - direction + - summary + type: object + example: null + WireTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + counterparty: + $ref: '#/components/schemas/counterparty' + description: + type: string + senderReference: + type: string + referenceForBeneficiary: + type: string + originatorToBeneficiaryInformation: + type: string + beneficiaryInformation: + type: string + beneficiaryAdviceInformation: + type: string + imadOmad: + $ref: '#/components/schemas/WirePayment_allOf_attributes_imadOmad' + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - counterparty + - createdAt + - direction + - summary + type: object + example: null + AdjustmentTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + description: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - summary + type: object + example: null + DisputeTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + reason: + type: string + disputeId: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - disputeId + - reason + - summary + type: object + example: null + CheckDepositTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + direction: + enum: + - Credit + - Debit + type: string + balance: + type: integer + summary: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - summary + type: object + example: null + ReturnedCheckDepositTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + direction: + enum: + - Credit + - Debit + type: string + balance: + type: integer + summary: + type: string + reason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - summary + type: object + example: null + ChargebackTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + counterparty: + $ref: '#/components/schemas/counterparty' + amount: + type: integer + balance: + type: integer + summary: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - summary + type: object + example: null + RewardTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + receiverCounterparty: + $ref: '#/components/schemas/counterparty' + amount: + type: integer + balance: + type: integer + summary: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - receiverCounterparty + - summary + type: object + example: null + AccountLowBalanceClosureTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - summary + type: object + example: null + BankRepaymentTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + paidForDate: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - paidForDate + - summary + type: object + example: null + CashDepositTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + direction: + enum: + - Credit + - Debit + type: string + amount: + type: integer + balance: + type: integer + summary: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + recurring: + type: boolean + required: + - amount + - balance + - cardLast4Digits + - createdAt + - direction + - merchant + - recurring + - summary + type: object + example: null + ReturnedCheckPaymentTransaction_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + amount: + type: integer + direction: + enum: + - Credit + - Debit + type: string + balance: + type: integer + summary: + type: string + reason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - balance + - createdAt + - direction + - reason + - summary + type: object + example: null + update_transaction_data: + oneOf: + - $ref: '#/components/schemas/patchTransactionTags' + - $ref: '#/components/schemas/patchBookTransaction' + - $ref: '#/components/schemas/patchChargebackTransaction' + patchTransactionTags_attributes: + additionalProperties: false + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - tags + type: object + patchBookTransaction_attributes: + additionalProperties: false + properties: + tags: + additionalProperties: false + maxProperties: 15 + type: object + summary: + type: string + type: object + patchBookTransaction_relationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/accountRelationship_1' + required: + - account + type: object + dispute_attributes_statusHistory_inner: + additionalProperties: false + properties: + type: + type: string + updatedAt: + format: date-time + type: string + type: object + dispute_attributes: + additionalProperties: false + properties: + source: + enum: + - DebitCard + - ACH + type: string + externalId: + maxLength: 255 + type: string + link: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + description: + maxLength: 1024 + type: string + amount: + type: integer + status: + type: string + statusHistory: + items: + $ref: '#/components/schemas/dispute_attributes_statusHistory_inner' + type: array + createdAt: + format: date-time + type: string + decisionReason: + type: string + required: + - amount + - createdAt + - description + - externalId + - source + - status + type: object + AchRepayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + sameDay: + type: boolean + status: + enum: + - Pending + - PendingReview + - Sent + - Returned + - Rejected + - Clearing + type: string + required: + - amount + - createdAt + - status + type: object + example: null + AchRepayment_allOf_relationships_account_data: + properties: + type: + enum: + - depositAccount + - account + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + example: null + AchRepayment_allOf_relationships_account: + properties: + data: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_account_data' + required: + - data + type: object + example: null + AchRepayment_allOf_relationships_creditAccount_data: + properties: + type: + default: creditAccount + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + example: null + AchRepayment_allOf_relationships_creditAccount: + properties: + data: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_creditAccount_data' + required: + - data + type: object + example: null + AchRepayment_allOf_relationships_counterparty_data: + properties: + type: + default: counterparty + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + example: null + AchRepayment_allOf_relationships_counterparty: + properties: + data: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_counterparty_data' + required: + - data + type: object + example: null + AchRepayment_allOf_relationships_customer_data: + properties: + type: + enum: + - businessCustomer + - individualCustomer + - customer + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + example: null + AchRepayment_allOf_relationships_customer: + properties: + data: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_customer_data' + required: + - data + type: object + example: null + AchRepayment_allOf_relationships_payment_data: + properties: + type: + default: payment + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + example: null + AchRepayment_allOf_relationships_payment: + properties: + data: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_payment_data' + required: + - data + type: object + example: null + AchRepayment_allOf_relationships: + properties: + account: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_account' + creditAccount: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_creditAccount' + counterparty: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_counterparty' + customer: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_customer' + payment: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_payment' + type: object + example: null + BookRepayment_allOf_attributes: + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + tags: + additionalProperties: false + maxProperties: 15 + type: object + status: + enum: + - Pending + - PendingReview + - Sent + - Returned + - Rejected + type: string + required: + - amount + - createdAt + - status + type: object + example: null + BookRepayment_allOf_relationships_counterpartyAccount_data: + properties: + type: + default: account + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + example: null + BookRepayment_allOf_relationships_counterpartyAccount: + properties: + data: + $ref: '#/components/schemas/BookRepayment_allOf_relationships_counterpartyAccount_data' + required: + - data + type: object + example: null + BookRepayment_allOf_relationships: + properties: + account: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_account' + creditAccount: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_creditAccount' + counterpartyAccount: + $ref: '#/components/schemas/BookRepayment_allOf_relationships_counterpartyAccount' + customer: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_customer' + payment: + $ref: '#/components/schemas/AchRepayment_allOf_relationships_payment' + type: object + example: null + createRepayment_data: + oneOf: + - $ref: '#/components/schemas/CreateAchRepayment' + - $ref: '#/components/schemas/CreateBookRepayment' + CreateAchRepayment_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + description: + maxLength: 10 + minLength: 1 + type: string + addenda: + maxLength: 80 + minLength: 1 + type: string + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + sameDay: + type: boolean + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - description + type: object + CreateAchRepayment_relationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/Relationship' + creditAccount: + $ref: '#/components/schemas/Relationship' + counterparty: + $ref: '#/components/schemas/Relationship' + required: + - account + - counterparty + - creditAccount + type: object + CreateBookRepayment_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + description: + maxLength: 80 + minLength: 1 + type: string + transactionSummaryOverride: + maxLength: 100 + minLength: 1 + type: string + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + required: + - amount + - description + type: object + CreateBookRepayment_relationships: + additionalProperties: false + properties: + account: + $ref: '#/components/schemas/Relationship' + creditAccount: + $ref: '#/components/schemas/Relationship' + counterpartyAccount: + $ref: '#/components/schemas/Relationship' + required: + - account + - counterpartyAccount + - creditAccount + type: object + CheckPayment_attributes_counterparty: + additionalProperties: false + properties: + name: + type: string + address: + $ref: '#/components/schemas/address' + counterpartyMoved: + type: boolean + type: object + CheckPayment_attributes: + additionalProperties: false + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + returnCutoffTime: + format: date-time + type: string + status: + enum: + - MarkedForReturn + - Returned + - Processed + - PendingReview + type: string + memo: + type: string + deliveryStatus: + enum: + - Mailed + - InLocalArea + - Delivered + - Rerouted + - ReturnedToSender + type: string + sendAt: + format: date-time + type: string + counterparty: + $ref: '#/components/schemas/CheckPayment_attributes_counterparty' + trackedAt: + format: date-time + type: string + postalCode: + type: string + expectedDelivery: + format: date + type: string + originated: + type: boolean + expirationDate: + format: date + type: string + rejectReason: + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + description: + type: string + returnReason: + $ref: '#/components/schemas/returnReason' + pendingReviewReasons: + items: + enum: + - NameMissMatch + - SoftLimit + type: string + type: array + checkNumber: + type: string + onUsAuxiliary: + type: string + onUs: + type: string + counterpartyRoutingNumber: + type: string + additionalVerificationStatus: + enum: + - Required + - NotRequired + - Approved + type: string + required: + - amount + - createdAt + - originated + - status + - updatedAt + type: object + CheckPayment_relationships: + properties: + account: + $ref: '#/components/schemas/recurringAchPaymentRelationships_account' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + customers: + $ref: '#/components/schemas/customersRelationship' + transaction: + $ref: '#/components/schemas/receivedPaymentRelationships_receivePaymentTransaction' + required: + - account + type: object + stopPayment_attributes: + additionalProperties: false + properties: + amount: + minimum: 1 + type: integer + checkNumber: + maxLength: 12 + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + idempotencyKey: + maxLength: 255 + minLength: 1 + type: string + required: + - amount + - checkNumber + type: object + relationships_1_account_data: + additionalProperties: false + properties: + type: + enum: + - account + - depositAccount + - financialBusinessFBOAccount + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + relationships_1_account: + additionalProperties: false + properties: + data: + $ref: '#/components/schemas/relationships_1_account_data' + required: + - data + type: object + orgRelationship_data: + additionalProperties: false + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + default: org + type: string + required: + - id + - type + type: object + Relationship_data: + additionalProperties: false + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + type: string + required: + - id + - type + type: object + applicationFormAdditionalDisclosures_inner: + properties: + title: + type: string + url: + pattern: "(http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\\ + b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)" + type: string + type: object + customerLinkage_data: + properties: + type: + enum: + - customer + - businessCustomer + - individualCustomer + type: string + id: + pattern: "^[1-9]\\d*$" + type: string + required: + - id + - type + type: object + customersRelationship_data_inner: + example: + id: id + type: customer + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + default: customer + type: string + type: object + stop_payment_attributes: + additionalProperties: false + example: + createdAt: 2000-01-23T04:56:07.000+00:00 + amount: 1 + checkNumber: checkNumber + updatedAt: 2000-01-23T04:56:07.000+00:00 + status: Active + tags: "{}" + properties: + createdAt: + format: date-time + type: string + updatedAt: + format: date-time + type: string + amount: + minimum: 1 + type: integer + status: + enum: + - Active + - Disabled + type: string + tags: + additionalProperties: false + maxProperties: 15 + type: object + checkNumber: + type: string + required: + - amount + - checkNumber + - createdAt + - updatedAt + type: object + stop_payment_relationships_checkPayments_data_inner: + example: + id: id + type: checkPayment + properties: + id: + pattern: "^[1-9]\\d*$" + type: string + type: + default: checkPayment + type: string + type: object + stop_payment_relationships_checkPayments: + additionalProperties: false + example: + data: + - id: id + type: checkPayment + - id: id + type: checkPayment + properties: + data: + items: + $ref: '#/components/schemas/stop_payment_relationships_checkPayments_data_inner' + type: array + required: + - data + type: object + stop_payment_relationships: + example: + checkPayments: + data: + - id: id + type: checkPayment + - id: id + type: checkPayment + customers: + data: + - id: id + type: customer + - id: id + type: customer + account: + data: + id: id + type: depositAccount + customer: + data: + id: id + type: businessCustomer + properties: + account: + $ref: '#/components/schemas/recurringAchPaymentRelationships_account' + customer: + $ref: '#/components/schemas/receivedPaymentRelationships_customer' + customers: + $ref: '#/components/schemas/customersRelationship' + checkPayments: + $ref: '#/components/schemas/stop_payment_relationships_checkPayments' + required: + - account + - customer + type: object + securitySchemes: + bearerAuth: + bearerFormat: JWT + scheme: bearer + type: http + diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..f67b3a7f --- /dev/null +++ b/build.gradle @@ -0,0 +1,186 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' +apply plugin: 'com.diffplug.spotless' + +group = 'co.unit.sdk' +version = '1.1-SNAPSHOT' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task) + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + groupId = 'co.unit' + artifactId = 'java-sdk' + version = '1.1-SNAPSHOT' + from components.java + + pom { + name = 'Unit Java SDK' + description = "This library provides a Java SDK to Unit's API." + } + } + } + + repositories { + maven { + name = "OSSRH" + url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + credentials { + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + } + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + jakarta_annotation_version = "1.3.5" +} + +dependencies { + implementation 'io.swagger:swagger-annotations:1.6.8' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.10.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.8.5' + implementation 'javax.ws.rs:jsr311-api:1.1.1' + implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + + removeUnusedImports() + importOrder() + } +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + +} diff --git a/build.sbt b/build.sbt new file mode 100644 index 00000000..953d7bc5 --- /dev/null +++ b/build.sbt @@ -0,0 +1,28 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "openapi-java-client", + version := "0.2.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.6.5", + "com.squareup.okhttp3" % "okhttp" % "4.10.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", + "com.google.code.gson" % "gson" % "2.9.1", + "org.apache.commons" % "commons-lang3" % "3.12.0", + "javax.ws.rs" % "jsr311-api" % "1.1.1", + "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6", + "io.gsonfire" % "gson-fire" % "1.8.5" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test", + "org.mockito" % "mockito-core" % "3.12.4" % "test" + ) + ) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..a3408578 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ffed3a25 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..005bcde0 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..6a68175e --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 00000000..15fef607 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.1.0" + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..82eef4a9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,352 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 0.2.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.3.0 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + javax.ws.rs + jsr311-api + ${jsr311-api-version} + + + javax.ws.rs + javax.ws.rs-api + ${javax.ws.rs-api-version} + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + org.mockito + mockito-core + ${mockito-core-version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.8.5 + 4.10.0 + 2.9.1 + 3.12.0 + 0.2.6 + 1.3.5 + 5.9.1 + 1.9.1 + 3.12.4 + 2.1.1 + 1.1.1 + UTF-8 + 2.27.2 + + diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..369ba54a --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 00000000..54fbcb3d --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/main/java/org/openapitools/client/ApiCallback.java b/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 00000000..ac910c4f --- /dev/null +++ b/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/src/main/java/org/openapitools/client/ApiClient.java b/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 00000000..192f5c2c --- /dev/null +++ b/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1565 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpBasicAuth; +import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + private String basePath = "https://api.s.unit.sh"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "https://api.s.unit.sh", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("bearerAuth", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("bearerAuth", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.2.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://api.s.unit.sh + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = JSON.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + return "application/json"; + } + + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams + List allQueryParams = new ArrayList(queryParams); + allQueryParams.addAll(collectionQueryParams); + + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // update parameters with authentication settings + updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + private String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/src/main/java/org/openapitools/client/ApiException.java b/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 00000000..6b9668fc --- /dev/null +++ b/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,165 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; +import java.util.List; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/src/main/java/org/openapitools/client/ApiResponse.java b/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 00000000..d92dc734 --- /dev/null +++ b/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/src/main/java/org/openapitools/client/Configuration.java b/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 00000000..5b6de771 --- /dev/null +++ b/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,41 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Configuration { + public static final String VERSION = "0.2.0"; + + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/src/main/java/org/openapitools/client/GzipRequestInterceptor.java new file mode 100644 index 00000000..4b311ce6 --- /dev/null +++ b/src/main/java/org/openapitools/client/GzipRequestInterceptor.java @@ -0,0 +1,85 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/src/main/java/org/openapitools/client/JSON.java b/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 00000000..54d06199 --- /dev/null +++ b/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,1732 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(org.openapitools.client.model.Account.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("creditAccount", org.openapitools.client.model.CreditAccount.class); + classByDiscriminatorValue.put("depositAccount", org.openapitools.client.model.DepositAccount.class); + classByDiscriminatorValue.put("account", org.openapitools.client.model.Account.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AccountLowBalanceClosureTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AccountLowBalanceClosureTransaction", org.openapitools.client.model.AccountLowBalanceClosureTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AchPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AchPayment", org.openapitools.client.model.AchPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AchRepayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AchRepayment", org.openapitools.client.model.AchRepayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AdjustmentTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AdjustmentTransaction", org.openapitools.client.model.AdjustmentTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Application.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("businessApplication", org.openapitools.client.model.BusinessApplication.class); + classByDiscriminatorValue.put("individualApplication", org.openapitools.client.model.IndividualApplication.class); + classByDiscriminatorValue.put("trustApplication", org.openapitools.client.model.TrustApplication.class); + classByDiscriminatorValue.put("application", org.openapitools.client.model.Application.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AtmAuthorizationRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AtmAuthorizationRequest", org.openapitools.client.model.AtmAuthorizationRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AtmTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AtmTransaction", org.openapitools.client.model.AtmTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.AuthorizationRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("atmAuthorizationRequest", org.openapitools.client.model.AtmAuthorizationRequest.class); + classByDiscriminatorValue.put("cardTransactionAuthorizationRequest", org.openapitools.client.model.CardTransactionAuthorizationRequest.class); + classByDiscriminatorValue.put("purchaseAuthorizationRequest", org.openapitools.client.model.PurchaseAuthorizationRequest.class); + classByDiscriminatorValue.put("authorization_request", org.openapitools.client.model.AuthorizationRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BankRepaymentTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BankRepaymentTransaction", org.openapitools.client.model.BankRepaymentTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BillPayTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BillPayTransaction", org.openapitools.client.model.BillPayTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BillPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BillPayment", org.openapitools.client.model.BillPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BookPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BookPayment", org.openapitools.client.model.BookPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BookRepayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BookRepayment", org.openapitools.client.model.BookRepayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BookTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BookTransaction", org.openapitools.client.model.BookTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BusinessApplication.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BusinessApplication", org.openapitools.client.model.BusinessApplication.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BusinessCreditCard.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BusinessCreditCard", org.openapitools.client.model.BusinessCreditCard.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BusinessCustomer.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BusinessCustomer", org.openapitools.client.model.BusinessCustomer.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BusinessDebitCard.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BusinessDebitCard", org.openapitools.client.model.BusinessDebitCard.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BusinessVirtualCreditCard.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BusinessVirtualCreditCard", org.openapitools.client.model.BusinessVirtualCreditCard.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.BusinessVirtualDebitCard.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BusinessVirtualDebitCard", org.openapitools.client.model.BusinessVirtualDebitCard.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Card.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("businessCreditCard", org.openapitools.client.model.BusinessCreditCard.class); + classByDiscriminatorValue.put("businessDebitCard", org.openapitools.client.model.BusinessDebitCard.class); + classByDiscriminatorValue.put("businessVirtualCreditCard", org.openapitools.client.model.BusinessVirtualCreditCard.class); + classByDiscriminatorValue.put("businessVirtualDebitCard", org.openapitools.client.model.BusinessVirtualDebitCard.class); + classByDiscriminatorValue.put("individualDebitCard", org.openapitools.client.model.IndividualDebitCard.class); + classByDiscriminatorValue.put("individualVirtualDebitCard", org.openapitools.client.model.IndividualVirtualDebitCard.class); + classByDiscriminatorValue.put("card", org.openapitools.client.model.Card.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CardTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CardTransaction", org.openapitools.client.model.CardTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CardTransactionAuthorizationRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CardTransactionAuthorizationRequest", org.openapitools.client.model.CardTransactionAuthorizationRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CashDepositTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CashDepositTransaction", org.openapitools.client.model.CashDepositTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ChargebackTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ChargebackTransaction", org.openapitools.client.model.ChargebackTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CheckDepositTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CheckDepositTransaction", org.openapitools.client.model.CheckDepositTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CheckPaymentTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CheckPaymentTransaction", org.openapitools.client.model.CheckPaymentTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CreditAccount.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CreditAccount", org.openapitools.client.model.CreditAccount.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CreditLimits.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CreditLimits", org.openapitools.client.model.CreditLimits.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Customer.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("businessCustomer", org.openapitools.client.model.BusinessCustomer.class); + classByDiscriminatorValue.put("individualCustomer", org.openapitools.client.model.IndividualCustomer.class); + classByDiscriminatorValue.put("trustCustomer", org.openapitools.client.model.TrustCustomer.class); + classByDiscriminatorValue.put("customer", org.openapitools.client.model.Customer.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CustomerRepaymentReturnedTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CustomerRepaymentReturnedTransaction", org.openapitools.client.model.CustomerRepaymentReturnedTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.CustomerRepaymentTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CustomerRepaymentTransaction", org.openapitools.client.model.CustomerRepaymentTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.DepositAccount.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DepositAccount", org.openapitools.client.model.DepositAccount.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.DepositLimits.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DepositLimits", org.openapitools.client.model.DepositLimits.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.DishonoredAchTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DishonoredAchTransaction", org.openapitools.client.model.DishonoredAchTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.DisputeSettlementTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DisputeSettlementTransaction", org.openapitools.client.model.DisputeSettlementTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.DisputeTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DisputeTransaction", org.openapitools.client.model.DisputeTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.FeeTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("FeeTransaction", org.openapitools.client.model.FeeTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.IndividualApplication.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IndividualApplication", org.openapitools.client.model.IndividualApplication.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.IndividualCustomer.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IndividualCustomer", org.openapitools.client.model.IndividualCustomer.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.IndividualDebitCard.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IndividualDebitCard", org.openapitools.client.model.IndividualDebitCard.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.IndividualVirtualDebitCard.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IndividualVirtualDebitCard", org.openapitools.client.model.IndividualVirtualDebitCard.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.InterchangeTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("InterchangeTransaction", org.openapitools.client.model.InterchangeTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.InterestShareTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("InterestShareTransaction", org.openapitools.client.model.InterestShareTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.InterestTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("InterestTransaction", org.openapitools.client.model.InterestTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Limits1.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("creditLimits", org.openapitools.client.model.CreditLimits.class); + classByDiscriminatorValue.put("limits", org.openapitools.client.model.DepositLimits.class); + classByDiscriminatorValue.put("limits_1", org.openapitools.client.model.Limits1.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.NegativeBalanceCoverageTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("NegativeBalanceCoverageTransaction", org.openapitools.client.model.NegativeBalanceCoverageTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.OriginatedAchTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OriginatedAchTransaction", org.openapitools.client.model.OriginatedAchTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Payment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("achPayment", org.openapitools.client.model.AchPayment.class); + classByDiscriminatorValue.put("billPayment", org.openapitools.client.model.BillPayment.class); + classByDiscriminatorValue.put("bookPayment", org.openapitools.client.model.BookPayment.class); + classByDiscriminatorValue.put("wirePayment", org.openapitools.client.model.WirePayment.class); + classByDiscriminatorValue.put("payment", org.openapitools.client.model.Payment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.PaymentAdvanceTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PaymentAdvanceTransaction", org.openapitools.client.model.PaymentAdvanceTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.PurchaseAuthorizationRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PurchaseAuthorizationRequest", org.openapitools.client.model.PurchaseAuthorizationRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.PurchaseTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PurchaseTransaction", org.openapitools.client.model.PurchaseTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReceivedAchTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReceivedAchTransaction", org.openapitools.client.model.ReceivedAchTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.RecurringCreditAchPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RecurringCreditAchPayment", org.openapitools.client.model.RecurringCreditAchPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.RecurringCreditBookPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RecurringCreditBookPayment", org.openapitools.client.model.RecurringCreditBookPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.RecurringDebitAchPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RecurringDebitAchPayment", org.openapitools.client.model.RecurringDebitAchPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.RecurringPayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("recurringCreditAchPayment", org.openapitools.client.model.RecurringCreditAchPayment.class); + classByDiscriminatorValue.put("recurringCreditBookPayment", org.openapitools.client.model.RecurringCreditBookPayment.class); + classByDiscriminatorValue.put("recurringDebitAchPayment", org.openapitools.client.model.RecurringDebitAchPayment.class); + classByDiscriminatorValue.put("recurring_payment", org.openapitools.client.model.RecurringPayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReleaseTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReleaseTransaction", org.openapitools.client.model.ReleaseTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.RepaidPaymentAdvanceTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RepaidPaymentAdvanceTransaction", org.openapitools.client.model.RepaidPaymentAdvanceTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Repayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("achRepayment", org.openapitools.client.model.AchRepayment.class); + classByDiscriminatorValue.put("bookRepayment", org.openapitools.client.model.BookRepayment.class); + classByDiscriminatorValue.put("repayment", org.openapitools.client.model.Repayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReturnedAchTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReturnedAchTransaction", org.openapitools.client.model.ReturnedAchTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReturnedCheckDepositTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReturnedCheckDepositTransaction", org.openapitools.client.model.ReturnedCheckDepositTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReturnedCheckPaymentTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReturnedCheckPaymentTransaction", org.openapitools.client.model.ReturnedCheckPaymentTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReturnedReceivedAchTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReturnedReceivedAchTransaction", org.openapitools.client.model.ReturnedReceivedAchTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.ReversalTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ReversalTransaction", org.openapitools.client.model.ReversalTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.RewardTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RewardTransaction", org.openapitools.client.model.RewardTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.SettlementTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("SettlementTransaction", org.openapitools.client.model.SettlementTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.SponsoredInterestTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("SponsoredInterestTransaction", org.openapitools.client.model.SponsoredInterestTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Transaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("accountLowBalanceClosureTransaction", org.openapitools.client.model.AccountLowBalanceClosureTransaction.class); + classByDiscriminatorValue.put("adjustmentTransaction", org.openapitools.client.model.AdjustmentTransaction.class); + classByDiscriminatorValue.put("atmTransaction", org.openapitools.client.model.AtmTransaction.class); + classByDiscriminatorValue.put("bankRepaymentTransaction", org.openapitools.client.model.BankRepaymentTransaction.class); + classByDiscriminatorValue.put("billPayTransaction", org.openapitools.client.model.BillPayTransaction.class); + classByDiscriminatorValue.put("bookTransaction", org.openapitools.client.model.BookTransaction.class); + classByDiscriminatorValue.put("cardTransaction", org.openapitools.client.model.CardTransaction.class); + classByDiscriminatorValue.put("cashDepositTransaction", org.openapitools.client.model.CashDepositTransaction.class); + classByDiscriminatorValue.put("chargebackTransaction", org.openapitools.client.model.ChargebackTransaction.class); + classByDiscriminatorValue.put("checkDepositTransaction", org.openapitools.client.model.CheckDepositTransaction.class); + classByDiscriminatorValue.put("checkPaymentTransaction", org.openapitools.client.model.CheckPaymentTransaction.class); + classByDiscriminatorValue.put("customerRepaymentReturnedTransaction", org.openapitools.client.model.CustomerRepaymentReturnedTransaction.class); + classByDiscriminatorValue.put("customerRepaymentTransaction", org.openapitools.client.model.CustomerRepaymentTransaction.class); + classByDiscriminatorValue.put("dishonoredAchTransaction", org.openapitools.client.model.DishonoredAchTransaction.class); + classByDiscriminatorValue.put("disputeSettlementTransaction", org.openapitools.client.model.DisputeSettlementTransaction.class); + classByDiscriminatorValue.put("disputeTransaction", org.openapitools.client.model.DisputeTransaction.class); + classByDiscriminatorValue.put("feeTransaction", org.openapitools.client.model.FeeTransaction.class); + classByDiscriminatorValue.put("interchangeTransaction", org.openapitools.client.model.InterchangeTransaction.class); + classByDiscriminatorValue.put("interestShareTransaction", org.openapitools.client.model.InterestShareTransaction.class); + classByDiscriminatorValue.put("interestTransaction", org.openapitools.client.model.InterestTransaction.class); + classByDiscriminatorValue.put("negativeBalanceCoverageTransaction", org.openapitools.client.model.NegativeBalanceCoverageTransaction.class); + classByDiscriminatorValue.put("originatedAchTransaction", org.openapitools.client.model.OriginatedAchTransaction.class); + classByDiscriminatorValue.put("paymentAdvanceTransaction", org.openapitools.client.model.PaymentAdvanceTransaction.class); + classByDiscriminatorValue.put("purchaseTransaction", org.openapitools.client.model.PurchaseTransaction.class); + classByDiscriminatorValue.put("receivedAchTransaction", org.openapitools.client.model.ReceivedAchTransaction.class); + classByDiscriminatorValue.put("releaseTransaction", org.openapitools.client.model.ReleaseTransaction.class); + classByDiscriminatorValue.put("repaidPaymentAdvanceTransaction", org.openapitools.client.model.RepaidPaymentAdvanceTransaction.class); + classByDiscriminatorValue.put("returnedAchTransaction", org.openapitools.client.model.ReturnedAchTransaction.class); + classByDiscriminatorValue.put("returnedCheckDepositTransaction", org.openapitools.client.model.ReturnedCheckDepositTransaction.class); + classByDiscriminatorValue.put("returnedCheckPaymentTransaction", org.openapitools.client.model.ReturnedCheckPaymentTransaction.class); + classByDiscriminatorValue.put("returnedReceivedAchTransaction", org.openapitools.client.model.ReturnedReceivedAchTransaction.class); + classByDiscriminatorValue.put("reversalTransaction", org.openapitools.client.model.ReversalTransaction.class); + classByDiscriminatorValue.put("rewardTransaction", org.openapitools.client.model.RewardTransaction.class); + classByDiscriminatorValue.put("settlementTransaction", org.openapitools.client.model.SettlementTransaction.class); + classByDiscriminatorValue.put("sponsoredInterestTransaction", org.openapitools.client.model.SponsoredInterestTransaction.class); + classByDiscriminatorValue.put("wireTransaction", org.openapitools.client.model.WireTransaction.class); + classByDiscriminatorValue.put("transaction", org.openapitools.client.model.Transaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.TrustApplication.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("TrustApplication", org.openapitools.client.model.TrustApplication.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.TrustCustomer.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("TrustCustomer", org.openapitools.client.model.TrustCustomer.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.WirePayment.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("WirePayment", org.openapitools.client.model.WirePayment.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(org.openapitools.client.model.WireTransaction.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("WireTransaction", org.openapitools.client.model.WireTransaction.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountEndOfDay.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountEndOfDayAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountLowBalanceClosureTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountLowBalanceClosureTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountRelationship1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountRelationship2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountRelationship2Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AccountRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchPaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsCounterpartyData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsCreditAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsCreditAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsCustomerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AchRepaymentAllOfRelationshipsPaymentData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Address.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AdjustmentTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AdjustmentTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApiToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApiTokenAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationForm.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationFormAdditionalDisclosuresInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationFormAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationFormRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationFormRelationshipsApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationFormRelationshipsApplicationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationshipsBeneficialOwners.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationshipsBeneficialOwnersDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationshipsBeneficiaries.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationshipsBeneficiariesDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationshipsTrustees.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApplicationRelationshipsTrusteesDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApproveAuthorizationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ApproveAuthorizationRequestAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Astra.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AtmAuthorizationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AtmAuthorizationRequestAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AtmTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AtmTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Authorization.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRequestRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRequestRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRequestRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRequestRelationshipsCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizationRequestRelationshipsCardData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AuthorizedUser.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BIN.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BankRepaymentTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BankRepaymentTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BeneficialOwner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BeneficialOwner1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Beneficiary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BillPayTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BillPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BillPaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookPaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookRepayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookRepaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookRepaymentAllOfRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookRepaymentAllOfRelationshipsCounterpartyAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookRepaymentAllOfRelationshipsCounterpartyAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BookTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessApplicationAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessCreditCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessCustomerAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessDebitCardAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessVirtualCreditCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessVirtualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.BusinessVirtualDebitCardAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardLevelLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardRelationshipsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardTransactionAuthorizationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardTransactionAuthorizationRequestAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CardVerificationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CashDepositTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CashDepositTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ChargebackRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ChargebackRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ChargebackTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ChargebackTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDeposit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositRelationshipsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositRelationshipsAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckDepositTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckPaymentAttributesCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckPaymentRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CheckPaymentTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CloseAccountRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CloseAccountRequestAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Contact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Coordinates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Counterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Counterparty1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Counterparty1Attributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Counterparty2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyAccountRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyAccountRelationship1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyAccountRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyBalance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyBalanceAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyBalanceRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyBalanceRelationshipsCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyBalanceRelationshipsCounterpartyData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyCustomerRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CounterpartyRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchCounterpartyAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentCounterpartyAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentCounterpartyRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentPlaid.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentPlaidAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchRepayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchRepaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateAchRepaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApiToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApiTokenAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApiTokenAttributesResourcesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApplicationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApplicationForm.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApplicationFormAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateApplicationFormRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBeneficialOwner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBillPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBillPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBookPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBookPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBookPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBookRepayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBookRepaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBookRepaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessCreditCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessVirtualCreditCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessVirtualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateBusinessVirtualDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCardRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCheckDeposit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCheckDepositAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCheckDepositRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCheckPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCounterpartyRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCreditAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCreditAccountAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCreditAccountRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCustomerToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCustomerTokenAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCustomerTokenVerification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCustomerTokenVerificationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateDepositAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateDepositAccountAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateDepositAccountRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateFee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateFeeAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateFeeRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndividualApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndividualApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndividualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndividualDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndividualVirtualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndividualVirtualDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateOfficer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePlaidCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePlaidCounterpartyAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePowerOfAttorneyAgent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePushToCardPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePushToCardPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreatePushToCardPaymentAttributesConfiguration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateRecurringPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateRepayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateRepaymentData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateReward.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateRewardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateRewardRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateSoleProprietorApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateSoleProprietorApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateStopPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateTrustApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateTrustApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateWebhook.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateWebhookData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateWebhookDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateWirePayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateWirePaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreditAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreditAccountAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreditAccountRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreditLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreditLimitsAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerLinkage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerLinkageData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerRepaymentReturnedTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerRepaymentTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerTokenAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerTokenVerification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomerTokenVerificationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomersRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CustomersRelationshipDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DeclineAuthorizationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DeclineAuthorizationRequestAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositAccountAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositAccountAllOfAttributesSecondaryAccountNumber.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositAccountRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesAch.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesAchLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesAchTotalsDaily.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesCardLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesCardTotalsDaily.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesCheckDeposit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DepositLimitsAllOfAttributesCheckDepositLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DeviceFingerprint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DishonoredAchTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DishonoredAchTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Dispute.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DisputeAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DisputeAttributesStatusHistoryInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DisputeRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DisputeSettlementTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DisputeTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DisputeTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Document.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DocumentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DocumentsRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.DocumentsRelationshipDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.EvaluationParams.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Event.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Execute200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Execute200Response1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Execute200Response2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Execute200Response3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter10.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter11.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter12.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter13.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter14.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter15.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter16.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter17.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter18.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter19.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter20.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter5.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter6.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter7.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter8.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteFilterParameter9.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest10.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest11.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest12.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest13.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest14.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest15.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest16.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest17.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest18.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest19.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest20.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest20Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest21.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest21Data.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest21DataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest5.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest5Attributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest6.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest7.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest8.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequest9.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ExecuteRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Fee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FeeAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FeeRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FeeTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FeeTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FreezeAccountRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FreezeAccountRequestAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FullName.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Grantor.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.HealthcareAmounts.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IncludedResourceInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IncomingAchRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IncomingAchRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualApplicationAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualCustomerAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualDebitCardAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualVirtualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndividualVirtualDebitCardAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Institution.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.InstitutionAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.InterchangeTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.InterestShareTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.InterestTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Limits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.LimitsAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.LimitsAttributesCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.LimitsAttributesCardLimits.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.LimitsAttributesCardTotalsDaily.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ListPageParametersObject.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Merchant.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.NegativeBalanceCoverageTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Officer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Officer1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OrgRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OrgRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OriginatedAchTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OriginatedAchTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaginationMeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaginationMetaPagination.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchAchPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchAchReceivedPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBookPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBookTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBookTransactionAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBookTransactionRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessCreditCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessVirtualCreditCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessVirtualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchBusinessVirtualDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchChargebackTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchCheckDeposit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchCheckDepositAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchCounterpartyAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchIndividualApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchIndividualApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchIndividualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchIndividualDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchIndividualVirtualDebitCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchIndividualVirtualDebitCardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchTransactionTags.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchTransactionTagsAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchTrustApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PatchTrustApplicationAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaymentAdvanceTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaymentRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaymentRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaymentRelationshipsCustomers.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PaymentRelationshipsCustomersDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Phone.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PinStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PinStatusAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PowerOfAttorneyAgent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Prefilled.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PurchaseAuthorizationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PurchaseAuthorizationRequestAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PurchaseTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PurchaseTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedAchTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedAchTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationshipsCustomerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransactionData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReceivingAccountRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationshipsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationshipsAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationshipsCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationshipsCounterpartyData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationshipsOrg.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringAchPaymentRelationshipsOrgData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringBookPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringBookPaymentRelationshipsCounterpartyAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringBookPaymentRelationshipsCounterpartyAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringCreditAchPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringCreditAchPaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringCreditBookPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringCreditBookPaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringDebitAchPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringDebitAchPaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringPaymentRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RecurringPaymentRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelatedTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelatedTransactionRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Relationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Relationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Relationships1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Relationships1Account.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Relationships1AccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelationshipsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelationshipsAccountData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelationshipsCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RelationshipsCustomerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReleaseTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReleaseTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RepaidPaymentAdvanceTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RepaymentRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RepaymentRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RequireIdVerification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ResponseContact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedAchTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedAchTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedCheckDepositTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedCheckDepositTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedCheckPaymentTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedCheckPaymentTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedReceivedAchTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedReceivedAchTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReturnedRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReversalTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ReversalTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Reward.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RewardAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RewardRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RewardRelationshipData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RewardRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RewardTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RewardTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Schedule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SettingsOverride.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SettlementTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SponsoredInterestTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Statement.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StatementAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StatementRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StatusEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StatusEventStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPaymentAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPaymentListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPaymentRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPaymentRelationshipsCheckPayments.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPaymentRelationshipsCheckPaymentsDataInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StopPaymentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TransactionRelationship.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TransactionRelationships.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TrustApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TrustApplicationAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TrustContact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TrustCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.TrustCustomerAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Trustee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitAccountResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitAccountResponseWithIncluded.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitAccountsListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitApiTokenResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitApplicationFormResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitApplicationFormResponseWithIncluded.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitApplicationFormsListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitApplicationResponseWithIncluded.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitAuthorizationRequestResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitAuthorizationRequestsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitAuthorizationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCancelApplicationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCardResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCardResponse1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCardResponse2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCardResponse3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCardResponseCardsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCheckDepositResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCheckDepositResponse1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCheckPaymentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCounterpartiesListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCounterpartyResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCounterpartyResponse1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCreateApplicationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCustomerResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCustomerTokenResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCustomerTokenVerificationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitCustomersListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitDisputeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitDocumentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitEventListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitEventResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitEventResponse1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitFeeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitGetAccountEndOfDayListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitGetAccountLimitsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitInstitutionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitListApplicationsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitOrgApiTokensListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitPaymentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitPaymentResponseWithIncluded.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitPaymentsListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitReceivedPaymentListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitReceivedPaymentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitReceivedPaymentResponseWithIncluded.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitRecurringPaymentListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitRecurringPaymentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitRepaymentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitRepaymentsListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitRewardResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitRewardsListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitStatementsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitTransactionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitTransactionResponse1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitTransactionsListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitWebhookResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UnitWebhooksListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateApplicationData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateBusinessCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateBusinessCustomerAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCard.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCardData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCheckDeposit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCounterpartyData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCreditAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCreditAccountAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateCustomerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateDepositAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateDepositAccountAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateIndividualCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateIndividualCustomerAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdatePayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdatePaymentData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateReceivedPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateReceivedPaymentData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateTransactionData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateTrustCustomer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateTrustCustomerAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateUnitRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateUnitRequestData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.UpdateUnitRequestDataAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Webhook.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WebhookAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WireCounterparty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WirePayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WirePaymentAllOfAttributes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WirePaymentAllOfAttributesImadOmad.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WireTransaction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.WireTransactionAllOfAttributes.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} diff --git a/src/main/java/org/openapitools/client/Pair.java b/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 00000000..4530c4ac --- /dev/null +++ b/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,57 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/src/main/java/org/openapitools/client/ProgressRequestBody.java b/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 00000000..52aca337 --- /dev/null +++ b/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/src/main/java/org/openapitools/client/ProgressResponseBody.java b/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 00000000..0cbe7565 --- /dev/null +++ b/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/src/main/java/org/openapitools/client/ServerConfiguration.java b/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 00000000..59edc528 --- /dev/null +++ b/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/org/openapitools/client/ServerVariable.java b/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 00000000..c2f13e21 --- /dev/null +++ b/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,23 @@ +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/org/openapitools/client/StringUtil.java b/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 00000000..d0793dbb --- /dev/null +++ b/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/src/main/java/org/openapitools/client/api/ActivateControlAgreementForAccountApi.java b/src/main/java/org/openapitools/client/api/ActivateControlAgreementForAccountApi.java new file mode 100644 index 00000000..8d190948 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ActivateControlAgreementForAccountApi.java @@ -0,0 +1,202 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ActivateControlAgreementForAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ActivateControlAgreementForAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public ActivateControlAgreementForAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/activate-daca" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Activate Account Control Agreement by Id + * Activate Control Agreement for Account via API + * @param accountId ID of the account (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Activate Account Control Agreement by Id + * Activate Control Agreement for Account via API + * @param accountId ID of the account (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Activate Account Control Agreement by Id (asynchronously) + * Activate Control Agreement for Account via API + * @param accountId ID of the account (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/AdvanceReceivedPaymentApi.java b/src/main/java/org/openapitools/client/api/AdvanceReceivedPaymentApi.java new file mode 100644 index 00000000..878acd8f --- /dev/null +++ b/src/main/java/org/openapitools/client/api/AdvanceReceivedPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitReceivedPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AdvanceReceivedPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AdvanceReceivedPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public AdvanceReceivedPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to advance (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/received-payments/{paymentId}/advance" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, _callback); + + } + + /** + * Advance Received Payment by Id + * Advance a Received Payment via API + * @param paymentId ID of the payment to advance (required) + * @return UnitReceivedPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitReceivedPaymentResponse execute(String paymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId); + return localVarResp.getData(); + } + + /** + * Advance Received Payment by Id + * Advance a Received Payment via API + * @param paymentId ID of the payment to advance (required) + * @return ApiResponse<UnitReceivedPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Advance Received Payment by Id (asynchronously) + * Advance a Received Payment via API + * @param paymentId ID of the payment to advance (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ApproveAuthorizationRequestApi.java b/src/main/java/org/openapitools/client/api/ApproveAuthorizationRequestApi.java new file mode 100644 index 00000000..cb177307 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ApproveAuthorizationRequestApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest10; +import org.openapitools.client.model.UnitAuthorizationRequestResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ApproveAuthorizationRequestApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ApproveAuthorizationRequestApi() { + this(Configuration.getDefaultApiClient()); + } + + public ApproveAuthorizationRequestApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param authorizationId ID of the authorization request to approve (required) + * @param executeRequest10 Approve Authorization Request Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String authorizationId, ExecuteRequest10 executeRequest10, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest10; + + // create path and map variables + String localVarPath = "/authorization-requests/{authorizationId}/approve" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String authorizationId, ExecuteRequest10 executeRequest10, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest10' is set + if (executeRequest10 == null) { + throw new ApiException("Missing the required parameter 'executeRequest10' when calling execute(Async)"); + } + + return executeCall(authorizationId, executeRequest10, _callback); + + } + + /** + * Approve Authorization Request by Id + * Approve a Authorization Request via API + * @param authorizationId ID of the authorization request to approve (required) + * @param executeRequest10 Approve Authorization Request Request (required) + * @return UnitAuthorizationRequestResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitAuthorizationRequestResponse execute(String authorizationId, ExecuteRequest10 executeRequest10) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(authorizationId, executeRequest10); + return localVarResp.getData(); + } + + /** + * Approve Authorization Request by Id + * Approve a Authorization Request via API + * @param authorizationId ID of the authorization request to approve (required) + * @param executeRequest10 Approve Authorization Request Request (required) + * @return ApiResponse<UnitAuthorizationRequestResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String authorizationId, ExecuteRequest10 executeRequest10) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, executeRequest10, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Approve Authorization Request by Id (asynchronously) + * Approve a Authorization Request via API + * @param authorizationId ID of the authorization request to approve (required) + * @param executeRequest10 Approve Authorization Request Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String authorizationId, ExecuteRequest10 executeRequest10, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, executeRequest10, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ApproveCheckPaymentApi.java b/src/main/java/org/openapitools/client/api/ApproveCheckPaymentApi.java new file mode 100644 index 00000000..3ea1418e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ApproveCheckPaymentApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest20; +import org.openapitools.client.model.UnitCheckPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ApproveCheckPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ApproveCheckPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public ApproveCheckPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkPaymentId ID of the check payment to approve (required) + * @param executeRequest20 Approve Check Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkPaymentId, ExecuteRequest20 executeRequest20, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest20; + + // create path and map variables + String localVarPath = "/check-payments/{checkPaymentId}/approve" + .replace("{" + "checkPaymentId" + "}", localVarApiClient.escapeString(checkPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkPaymentId, ExecuteRequest20 executeRequest20, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkPaymentId' is set + if (checkPaymentId == null) { + throw new ApiException("Missing the required parameter 'checkPaymentId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest20' is set + if (executeRequest20 == null) { + throw new ApiException("Missing the required parameter 'executeRequest20' when calling execute(Async)"); + } + + return executeCall(checkPaymentId, executeRequest20, _callback); + + } + + /** + * Approve Check Payment by Id + * Approve a Check Payment via API + * @param checkPaymentId ID of the check payment to approve (required) + * @param executeRequest20 Approve Check Payment Request (required) + * @return UnitCheckPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckPaymentResponse execute(String checkPaymentId, ExecuteRequest20 executeRequest20) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkPaymentId, executeRequest20); + return localVarResp.getData(); + } + + /** + * Approve Check Payment by Id + * Approve a Check Payment via API + * @param checkPaymentId ID of the check payment to approve (required) + * @param executeRequest20 Approve Check Payment Request (required) + * @return ApiResponse<UnitCheckPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkPaymentId, ExecuteRequest20 executeRequest20) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, executeRequest20, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Approve Check Payment by Id (asynchronously) + * Approve a Check Payment via API + * @param checkPaymentId ID of the check payment to approve (required) + * @param executeRequest20 Approve Check Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkPaymentId, ExecuteRequest20 executeRequest20, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, executeRequest20, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ArchiveCustomerApi.java b/src/main/java/org/openapitools/client/api/ArchiveCustomerApi.java new file mode 100644 index 00000000..b085f617 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ArchiveCustomerApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest5; +import org.openapitools.client.model.UnitCustomerResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ArchiveCustomerApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ArchiveCustomerApi() { + this(Configuration.getDefaultApiClient()); + } + + public ArchiveCustomerApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param customerId ID of the customer to archive (required) + * @param executeRequest5 Update Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String customerId, ExecuteRequest5 executeRequest5, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest5; + + // create path and map variables + String localVarPath = "/customers/{customerId}/archive" + .replace("{" + "customerId" + "}", localVarApiClient.escapeString(customerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String customerId, ExecuteRequest5 executeRequest5, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerId' is set + if (customerId == null) { + throw new ApiException("Missing the required parameter 'customerId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest5' is set + if (executeRequest5 == null) { + throw new ApiException("Missing the required parameter 'executeRequest5' when calling execute(Async)"); + } + + return executeCall(customerId, executeRequest5, _callback); + + } + + /** + * Archive Customer by Id + * Archive a Customer via API + * @param customerId ID of the customer to archive (required) + * @param executeRequest5 Update Payment Request (required) + * @return UnitCustomerResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCustomerResponse execute(String customerId, ExecuteRequest5 executeRequest5) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(customerId, executeRequest5); + return localVarResp.getData(); + } + + /** + * Archive Customer by Id + * Archive a Customer via API + * @param customerId ID of the customer to archive (required) + * @param executeRequest5 Update Payment Request (required) + * @return ApiResponse<UnitCustomerResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String customerId, ExecuteRequest5 executeRequest5) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, executeRequest5, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Archive Customer by Id (asynchronously) + * Archive a Customer via API + * @param customerId ID of the customer to archive (required) + * @param executeRequest5 Update Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String customerId, ExecuteRequest5 executeRequest5, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, executeRequest5, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CancelApplicationApi.java b/src/main/java/org/openapitools/client/api/CancelApplicationApi.java new file mode 100644 index 00000000..a81452f4 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CancelApplicationApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest; +import org.openapitools.client.model.UnitCancelApplicationResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CancelApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CancelApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public CancelApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to get (required) + * @param executeRequest Cancel Application Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, ExecuteRequest executeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/cancel" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, ExecuteRequest executeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest' is set + if (executeRequest == null) { + throw new ApiException("Missing the required parameter 'executeRequest' when calling execute(Async)"); + } + + return executeCall(applicationId, executeRequest, _callback); + + } + + /** + * Cancel Application by Id + * Cancel a Application via API + * @param applicationId ID of the application to get (required) + * @param executeRequest Cancel Application Request (required) + * @return UnitCancelApplicationResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCancelApplicationResponse execute(String applicationId, ExecuteRequest executeRequest) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, executeRequest); + return localVarResp.getData(); + } + + /** + * Cancel Application by Id + * Cancel a Application via API + * @param applicationId ID of the application to get (required) + * @param executeRequest Cancel Application Request (required) + * @return ApiResponse<UnitCancelApplicationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, ExecuteRequest executeRequest) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, executeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Cancel Application by Id (asynchronously) + * Cancel a Application via API + * @param applicationId ID of the application to get (required) + * @param executeRequest Cancel Application Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, ExecuteRequest executeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, executeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CancelCheckPaymentApi.java b/src/main/java/org/openapitools/client/api/CancelCheckPaymentApi.java new file mode 100644 index 00000000..7e12417e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CancelCheckPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CancelCheckPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CancelCheckPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public CancelCheckPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkPaymentId ID of the check payment to cancel (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-payments/{checkPaymentId}/cancel" + .replace("{" + "checkPaymentId" + "}", localVarApiClient.escapeString(checkPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkPaymentId' is set + if (checkPaymentId == null) { + throw new ApiException("Missing the required parameter 'checkPaymentId' when calling execute(Async)"); + } + + return executeCall(checkPaymentId, _callback); + + } + + /** + * Cancel Check Payment by Id + * Cancel a Check Payment via API + * @param checkPaymentId ID of the check payment to cancel (required) + * @return UnitCheckPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckPaymentResponse execute(String checkPaymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkPaymentId); + return localVarResp.getData(); + } + + /** + * Cancel Check Payment by Id + * Cancel a Check Payment via API + * @param checkPaymentId ID of the check payment to cancel (required) + * @return ApiResponse<UnitCheckPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkPaymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Cancel Check Payment by Id (asynchronously) + * Cancel a Check Payment via API + * @param checkPaymentId ID of the check payment to cancel (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CancelPaymentApi.java b/src/main/java/org/openapitools/client/api/CancelPaymentApi.java new file mode 100644 index 00000000..05612cc1 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CancelPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CancelPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CancelPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public CancelPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to cancel (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/payments/{paymentId}/cancel" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, _callback); + + } + + /** + * Cancel a Payment by Id + * Cancel a Payment via API + * @param paymentId ID of the payment to cancel (required) + * @return UnitPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitPaymentResponse execute(String paymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId); + return localVarResp.getData(); + } + + /** + * Cancel a Payment by Id + * Cancel a Payment via API + * @param paymentId ID of the payment to cancel (required) + * @return ApiResponse<UnitPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Cancel a Payment by Id (asynchronously) + * Cancel a Payment via API + * @param paymentId ID of the payment to cancel (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CloseACardApi.java b/src/main/java/org/openapitools/client/api/CloseACardApi.java new file mode 100644 index 00000000..3f2a4ed6 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CloseACardApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CloseACardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CloseACardApi() { + this(Configuration.getDefaultApiClient()); + } + + public CloseACardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to close (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/close" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Close a Card + * Close a Card via API + * @param cardId ID of the card to close (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Close a Card + * Close a Card via API + * @param cardId ID of the card to close (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Close a Card (asynchronously) + * Close a Card via API + * @param cardId ID of the card to close (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CloseAnAccountApi.java b/src/main/java/org/openapitools/client/api/CloseAnAccountApi.java new file mode 100644 index 00000000..59e34f49 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CloseAnAccountApi.java @@ -0,0 +1,213 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest4; +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CloseAnAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CloseAnAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public CloseAnAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to close (required) + * @param executeRequest4 Close Account Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, ExecuteRequest4 executeRequest4, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest4; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/close" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, ExecuteRequest4 executeRequest4, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest4' is set + if (executeRequest4 == null) { + throw new ApiException("Missing the required parameter 'executeRequest4' when calling execute(Async)"); + } + + return executeCall(accountId, executeRequest4, _callback); + + } + + /** + * Close an Account by Id + * Close an Account via API + * @param accountId ID of the account to close (required) + * @param executeRequest4 Close Account Request (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId, ExecuteRequest4 executeRequest4) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId, executeRequest4); + return localVarResp.getData(); + } + + /** + * Close an Account by Id + * Close an Account via API + * @param accountId ID of the account to close (required) + * @param executeRequest4 Close Account Request (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId, ExecuteRequest4 executeRequest4) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, executeRequest4, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Close an Account by Id (asynchronously) + * Close an Account via API + * @param accountId ID of the account to close (required) + * @param executeRequest4 Close Account Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, ExecuteRequest4 executeRequest4, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, executeRequest4, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ConfirmCheckDepositApi.java b/src/main/java/org/openapitools/client/api/ConfirmCheckDepositApi.java new file mode 100644 index 00000000..d341ed80 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ConfirmCheckDepositApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckDepositResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ConfirmCheckDepositApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ConfirmCheckDepositApi() { + this(Configuration.getDefaultApiClient()); + } + + public ConfirmCheckDepositApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkDepositId ID of the check deposit to confirm (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-deposits/{checkDepositId}/confirm" + .replace("{" + "checkDepositId" + "}", localVarApiClient.escapeString(checkDepositId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkDepositId' is set + if (checkDepositId == null) { + throw new ApiException("Missing the required parameter 'checkDepositId' when calling execute(Async)"); + } + + return executeCall(checkDepositId, _callback); + + } + + /** + * Confirm by Id + * Confirm a Check Deposit from API + * @param checkDepositId ID of the check deposit to confirm (required) + * @return UnitCheckDepositResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckDepositResponse execute(String checkDepositId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkDepositId); + return localVarResp.getData(); + } + + /** + * Confirm by Id + * Confirm a Check Deposit from API + * @param checkDepositId ID of the check deposit to confirm (required) + * @return ApiResponse<UnitCheckDepositResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkDepositId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Confirm by Id (asynchronously) + * Confirm a Check Deposit from API + * @param checkDepositId ID of the check deposit to confirm (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkDepositId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateACardApi.java b/src/main/java/org/openapitools/client/api/CreateACardApi.java new file mode 100644 index 00000000..6eeca764 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateACardApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest9; +import org.openapitools.client.model.UnitCardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateACardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateACardApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateACardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest9 Create Card Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest9 executeRequest9, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest9; + + // create path and map variables + String localVarPath = "/cards"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest9 executeRequest9, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest9' is set + if (executeRequest9 == null) { + throw new ApiException("Missing the required parameter 'executeRequest9' when calling execute(Async)"); + } + + return executeCall(executeRequest9, _callback); + + } + + /** + * Create a Card + * Create a Card via API + * @param executeRequest9 Create Card Request (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCardResponse execute(ExecuteRequest9 executeRequest9) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest9); + return localVarResp.getData(); + } + + /** + * Create a Card + * Create a Card via API + * @param executeRequest9 Create Card Request (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest9 executeRequest9) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest9, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a Card (asynchronously) + * Create a Card via API + * @param executeRequest9 Create Card Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest9 executeRequest9, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest9, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateADocumentForAnApplicationApi.java b/src/main/java/org/openapitools/client/api/CreateADocumentForAnApplicationApi.java new file mode 100644 index 00000000..363759f7 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateADocumentForAnApplicationApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateADocumentForAnApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateADocumentForAnApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateADocumentForAnApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to create a file for (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + return executeCall(applicationId, _callback); + + } + + /** + * Create a document + * Create a document via API + * @param applicationId ID of the application to create a file for (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId); + return localVarResp.getData(); + } + + /** + * Create a document + * Create a document via API + * @param applicationId ID of the application to create a file for (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a document (asynchronously) + * Create a document via API + * @param applicationId ID of the application to create a file for (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateAPaymentApi.java b/src/main/java/org/openapitools/client/api/CreateAPaymentApi.java new file mode 100644 index 00000000..945ab44a --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateAPaymentApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest6; +import org.openapitools.client.model.UnitPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateAPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateAPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateAPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest6 Create Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest6 executeRequest6, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest6; + + // create path and map variables + String localVarPath = "/payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest6 executeRequest6, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest6' is set + if (executeRequest6 == null) { + throw new ApiException("Missing the required parameter 'executeRequest6' when calling execute(Async)"); + } + + return executeCall(executeRequest6, _callback); + + } + + /** + * Create a Payment + * Create a Payment via API + * @param executeRequest6 Create Payment Request (required) + * @return UnitPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitPaymentResponse execute(ExecuteRequest6 executeRequest6) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest6); + return localVarResp.getData(); + } + + /** + * Create a Payment + * Create a Payment via API + * @param executeRequest6 Create Payment Request (required) + * @return ApiResponse<UnitPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest6 executeRequest6) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest6, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a Payment (asynchronously) + * Create a Payment via API + * @param executeRequest6 Create Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest6 executeRequest6, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest6, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateARepaymentApi.java b/src/main/java/org/openapitools/client/api/CreateARepaymentApi.java new file mode 100644 index 00000000..9fb6bf8c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateARepaymentApi.java @@ -0,0 +1,203 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest18; +import org.openapitools.client.model.UnitRepaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateARepaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateARepaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateARepaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest18 Create a Repayment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(ExecuteRequest18 executeRequest18, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest18; + + // create path and map variables + String localVarPath = "/repayments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest18 executeRequest18, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest18' is set + if (executeRequest18 == null) { + throw new ApiException("Missing the required parameter 'executeRequest18' when calling execute(Async)"); + } + + return executeCall(executeRequest18, _callback); + + } + + /** + * Create a Repayment + * Create a Repayment via API + * @param executeRequest18 Create a Repayment Request (required) + * @return UnitRepaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public UnitRepaymentResponse execute(ExecuteRequest18 executeRequest18) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest18); + return localVarResp.getData(); + } + + /** + * Create a Repayment + * Create a Repayment via API + * @param executeRequest18 Create a Repayment Request (required) + * @return ApiResponse<UnitRepaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest18 executeRequest18) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest18, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a Repayment (asynchronously) + * Create a Repayment via API + * @param executeRequest18 Create a Repayment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest18 executeRequest18, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest18, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateAccountApi.java b/src/main/java/org/openapitools/client/api/CreateAccountApi.java new file mode 100644 index 00000000..485b1f81 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateAccountApi.java @@ -0,0 +1,203 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.CreateAccount; +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param createAccount Create Account Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(CreateAccount createAccount, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createAccount; + + // create path and map variables + String localVarPath = "/accounts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(CreateAccount createAccount, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createAccount' is set + if (createAccount == null) { + throw new ApiException("Missing the required parameter 'createAccount' when calling execute(Async)"); + } + + return executeCall(createAccount, _callback); + + } + + /** + * Create Account + * Create Account via API + * @param createAccount Create Account Request (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(CreateAccount createAccount) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(createAccount); + return localVarResp.getData(); + } + + /** + * Create Account + * Create Account via API + * @param createAccount Create Account Request (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(CreateAccount createAccount) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(createAccount, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Account (asynchronously) + * Create Account via API + * @param createAccount Create Account Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
201 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(CreateAccount createAccount, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(createAccount, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateApplicationApi.java b/src/main/java/org/openapitools/client/api/CreateApplicationApi.java new file mode 100644 index 00000000..51fc0af3 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateApplicationApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.CreateApplication; +import org.openapitools.client.model.UnitCreateApplicationResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param createApplication Create Application Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(CreateApplication createApplication, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createApplication; + + // create path and map variables + String localVarPath = "/applications"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(CreateApplication createApplication, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createApplication' is set + if (createApplication == null) { + throw new ApiException("Missing the required parameter 'createApplication' when calling execute(Async)"); + } + + return executeCall(createApplication, _callback); + + } + + /** + * Create Application + * Create an Application via API + * @param createApplication Create Application Request (required) + * @return UnitCreateApplicationResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCreateApplicationResponse execute(CreateApplication createApplication) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(createApplication); + return localVarResp.getData(); + } + + /** + * Create Application + * Create an Application via API + * @param createApplication Create Application Request (required) + * @return ApiResponse<UnitCreateApplicationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(CreateApplication createApplication) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(createApplication, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Application (asynchronously) + * Create an Application via API + * @param createApplication Create Application Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(CreateApplication createApplication, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(createApplication, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateApplicationFormApi.java b/src/main/java/org/openapitools/client/api/CreateApplicationFormApi.java new file mode 100644 index 00000000..52c084b5 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateApplicationFormApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest1; +import org.openapitools.client.model.UnitApplicationFormResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateApplicationFormApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateApplicationFormApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateApplicationFormApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest1 Create Application Form Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest1 executeRequest1, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest1; + + // create path and map variables + String localVarPath = "/application-forms"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest1 executeRequest1, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest1' is set + if (executeRequest1 == null) { + throw new ApiException("Missing the required parameter 'executeRequest1' when calling execute(Async)"); + } + + return executeCall(executeRequest1, _callback); + + } + + /** + * Create Application Form + * Create an Application Form via API + * @param executeRequest1 Create Application Form Request (required) + * @return UnitApplicationFormResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitApplicationFormResponse execute(ExecuteRequest1 executeRequest1) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest1); + return localVarResp.getData(); + } + + /** + * Create Application Form + * Create an Application Form via API + * @param executeRequest1 Create Application Form Request (required) + * @return ApiResponse<UnitApplicationFormResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest1 executeRequest1) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest1, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Application Form (asynchronously) + * Create an Application Form via API + * @param executeRequest1 Create Application Form Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest1 executeRequest1, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest1, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateCheckDepositApi.java b/src/main/java/org/openapitools/client/api/CreateCheckDepositApi.java new file mode 100644 index 00000000..c1da89ef --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateCheckDepositApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest14; +import org.openapitools.client.model.UnitCheckDepositResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateCheckDepositApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateCheckDepositApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateCheckDepositApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest14 Create Check Deposit Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest14 executeRequest14, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest14; + + // create path and map variables + String localVarPath = "/check-deposits"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest14 executeRequest14, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest14' is set + if (executeRequest14 == null) { + throw new ApiException("Missing the required parameter 'executeRequest14' when calling execute(Async)"); + } + + return executeCall(executeRequest14, _callback); + + } + + /** + * Create Check Deposit + * Create a Check Deposit via API + * @param executeRequest14 Create Check Deposit Request (required) + * @return UnitCheckDepositResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCheckDepositResponse execute(ExecuteRequest14 executeRequest14) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest14); + return localVarResp.getData(); + } + + /** + * Create Check Deposit + * Create a Check Deposit via API + * @param executeRequest14 Create Check Deposit Request (required) + * @return ApiResponse<UnitCheckDepositResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest14 executeRequest14) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest14, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Check Deposit (asynchronously) + * Create a Check Deposit via API + * @param executeRequest14 Create Check Deposit Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest14 executeRequest14, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest14, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateCheckPaymentApi.java b/src/main/java/org/openapitools/client/api/CreateCheckPaymentApi.java new file mode 100644 index 00000000..5c79b1d7 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateCheckPaymentApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest19; +import org.openapitools.client.model.UnitCheckPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateCheckPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateCheckPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateCheckPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest19 Create Check Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest19 executeRequest19, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest19; + + // create path and map variables + String localVarPath = "/check-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest19 executeRequest19, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest19' is set + if (executeRequest19 == null) { + throw new ApiException("Missing the required parameter 'executeRequest19' when calling execute(Async)"); + } + + return executeCall(executeRequest19, _callback); + + } + + /** + * Create Check Payment + * Create Check Payment via API + * @param executeRequest19 Create Check Payment Request (required) + * @return UnitCheckPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCheckPaymentResponse execute(ExecuteRequest19 executeRequest19) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest19); + return localVarResp.getData(); + } + + /** + * Create Check Payment + * Create Check Payment via API + * @param executeRequest19 Create Check Payment Request (required) + * @return ApiResponse<UnitCheckPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest19 executeRequest19) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest19, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Check Payment (asynchronously) + * Create Check Payment via API + * @param executeRequest19 Create Check Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest19 executeRequest19, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest19, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateCounterpartyApi.java b/src/main/java/org/openapitools/client/api/CreateCounterpartyApi.java new file mode 100644 index 00000000..68ff20ed --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateCounterpartyApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest7; +import org.openapitools.client.model.UnitCounterpartyResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateCounterpartyApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateCounterpartyApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateCounterpartyApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest7 Create Counterparty Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest7 executeRequest7, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest7; + + // create path and map variables + String localVarPath = "/counterparties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest7 executeRequest7, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest7' is set + if (executeRequest7 == null) { + throw new ApiException("Missing the required parameter 'executeRequest7' when calling execute(Async)"); + } + + return executeCall(executeRequest7, _callback); + + } + + /** + * Create Counterparty + * Create a counterparty via API + * @param executeRequest7 Create Counterparty Request (required) + * @return UnitCounterpartyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCounterpartyResponse execute(ExecuteRequest7 executeRequest7) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest7); + return localVarResp.getData(); + } + + /** + * Create Counterparty + * Create a counterparty via API + * @param executeRequest7 Create Counterparty Request (required) + * @return ApiResponse<UnitCounterpartyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest7 executeRequest7) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest7, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Counterparty (asynchronously) + * Create a counterparty via API + * @param executeRequest7 Create Counterparty Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest7 executeRequest7, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest7, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateCustomerTokenApi.java b/src/main/java/org/openapitools/client/api/CreateCustomerTokenApi.java new file mode 100644 index 00000000..81a5d3bf --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateCustomerTokenApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest16; +import org.openapitools.client.model.UnitCustomerTokenResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateCustomerTokenApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateCustomerTokenApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateCustomerTokenApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param customerId ID of the customer to create token for (required) + * @param executeRequest16 Create Customer Token Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(String customerId, ExecuteRequest16 executeRequest16, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest16; + + // create path and map variables + String localVarPath = "/customers/{customerId}/token" + .replace("{" + "customerId" + "}", localVarApiClient.escapeString(customerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String customerId, ExecuteRequest16 executeRequest16, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerId' is set + if (customerId == null) { + throw new ApiException("Missing the required parameter 'customerId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest16' is set + if (executeRequest16 == null) { + throw new ApiException("Missing the required parameter 'executeRequest16' when calling execute(Async)"); + } + + return executeCall(customerId, executeRequest16, _callback); + + } + + /** + * Create Customer Token + * Create a Customer Token via API + * @param customerId ID of the customer to create token for (required) + * @param executeRequest16 Create Customer Token Request (required) + * @return UnitCustomerTokenResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCustomerTokenResponse execute(String customerId, ExecuteRequest16 executeRequest16) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(customerId, executeRequest16); + return localVarResp.getData(); + } + + /** + * Create Customer Token + * Create a Customer Token via API + * @param customerId ID of the customer to create token for (required) + * @param executeRequest16 Create Customer Token Request (required) + * @return ApiResponse<UnitCustomerTokenResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String customerId, ExecuteRequest16 executeRequest16) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, executeRequest16, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Customer Token (asynchronously) + * Create a Customer Token via API + * @param customerId ID of the customer to create token for (required) + * @param executeRequest16 Create Customer Token Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(String customerId, ExecuteRequest16 executeRequest16, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, executeRequest16, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateCustomerTokenVerificationApi.java b/src/main/java/org/openapitools/client/api/CreateCustomerTokenVerificationApi.java new file mode 100644 index 00000000..26be02fc --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateCustomerTokenVerificationApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest17; +import org.openapitools.client.model.UnitCustomerTokenVerificationResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateCustomerTokenVerificationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateCustomerTokenVerificationApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateCustomerTokenVerificationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param customerId ID of the customer to create token for (required) + * @param executeRequest17 Create Customer Token Verification Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(String customerId, ExecuteRequest17 executeRequest17, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest17; + + // create path and map variables + String localVarPath = "/customers/{customerId}/token/verification" + .replace("{" + "customerId" + "}", localVarApiClient.escapeString(customerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String customerId, ExecuteRequest17 executeRequest17, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerId' is set + if (customerId == null) { + throw new ApiException("Missing the required parameter 'customerId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest17' is set + if (executeRequest17 == null) { + throw new ApiException("Missing the required parameter 'executeRequest17' when calling execute(Async)"); + } + + return executeCall(customerId, executeRequest17, _callback); + + } + + /** + * Create Customer Token Verification + * Create a Customer Token Verification via API + * @param customerId ID of the customer to create token for (required) + * @param executeRequest17 Create Customer Token Verification Request (required) + * @return UnitCustomerTokenVerificationResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitCustomerTokenVerificationResponse execute(String customerId, ExecuteRequest17 executeRequest17) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(customerId, executeRequest17); + return localVarResp.getData(); + } + + /** + * Create Customer Token Verification + * Create a Customer Token Verification via API + * @param customerId ID of the customer to create token for (required) + * @param executeRequest17 Create Customer Token Verification Request (required) + * @return ApiResponse<UnitCustomerTokenVerificationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String customerId, ExecuteRequest17 executeRequest17) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, executeRequest17, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Customer Token Verification (asynchronously) + * Create a Customer Token Verification via API + * @param customerId ID of the customer to create token for (required) + * @param executeRequest17 Create Customer Token Verification Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(String customerId, ExecuteRequest17 executeRequest17, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, executeRequest17, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateFeeApi.java b/src/main/java/org/openapitools/client/api/CreateFeeApi.java new file mode 100644 index 00000000..ce82bff9 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateFeeApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest13; +import org.openapitools.client.model.UnitFeeResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateFeeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateFeeApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateFeeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest13 Create Fee Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest13 executeRequest13, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest13; + + // create path and map variables + String localVarPath = "/fees"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest13 executeRequest13, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest13' is set + if (executeRequest13 == null) { + throw new ApiException("Missing the required parameter 'executeRequest13' when calling execute(Async)"); + } + + return executeCall(executeRequest13, _callback); + + } + + /** + * Create Fee + * Create a Fee via API + * @param executeRequest13 Create Fee Request (required) + * @return UnitFeeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitFeeResponse execute(ExecuteRequest13 executeRequest13) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest13); + return localVarResp.getData(); + } + + /** + * Create Fee + * Create a Fee via API + * @param executeRequest13 Create Fee Request (required) + * @return ApiResponse<UnitFeeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest13 executeRequest13) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest13, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Fee (asynchronously) + * Create a Fee via API + * @param executeRequest13 Create Fee Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest13 executeRequest13, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest13, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateOrgApiTokenApi.java b/src/main/java/org/openapitools/client/api/CreateOrgApiTokenApi.java new file mode 100644 index 00000000..9ab78ab1 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateOrgApiTokenApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest15; +import org.openapitools.client.model.UnitApiTokenResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateOrgApiTokenApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateOrgApiTokenApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateOrgApiTokenApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param userId ID of the user to create token for (required) + * @param executeRequest15 Create Org API Token Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(String userId, ExecuteRequest15 executeRequest15, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest15; + + // create path and map variables + String localVarPath = "/users/{userId}/api-tokens" + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String userId, ExecuteRequest15 executeRequest15, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest15' is set + if (executeRequest15 == null) { + throw new ApiException("Missing the required parameter 'executeRequest15' when calling execute(Async)"); + } + + return executeCall(userId, executeRequest15, _callback); + + } + + /** + * Create Org API Token + * Create an Org API Token via API + * @param userId ID of the user to create token for (required) + * @param executeRequest15 Create Org API Token Request (required) + * @return UnitApiTokenResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitApiTokenResponse execute(String userId, ExecuteRequest15 executeRequest15) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(userId, executeRequest15); + return localVarResp.getData(); + } + + /** + * Create Org API Token + * Create an Org API Token via API + * @param userId ID of the user to create token for (required) + * @param executeRequest15 Create Org API Token Request (required) + * @return ApiResponse<UnitApiTokenResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String userId, ExecuteRequest15 executeRequest15) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(userId, executeRequest15, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Org API Token (asynchronously) + * Create an Org API Token via API + * @param userId ID of the user to create token for (required) + * @param executeRequest15 Create Org API Token Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(String userId, ExecuteRequest15 executeRequest15, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(userId, executeRequest15, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateRecurringPaymentApi.java b/src/main/java/org/openapitools/client/api/CreateRecurringPaymentApi.java new file mode 100644 index 00000000..e2670e00 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateRecurringPaymentApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest8; +import org.openapitools.client.model.UnitRecurringPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateRecurringPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateRecurringPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateRecurringPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest8 Create Recurring Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest8 executeRequest8, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest8; + + // create path and map variables + String localVarPath = "/recurring-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest8 executeRequest8, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest8' is set + if (executeRequest8 == null) { + throw new ApiException("Missing the required parameter 'executeRequest8' when calling execute(Async)"); + } + + return executeCall(executeRequest8, _callback); + + } + + /** + * Create Recurring Payment + * Create a Recurring Payment via API + * @param executeRequest8 Create Recurring Payment Request (required) + * @return UnitRecurringPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitRecurringPaymentResponse execute(ExecuteRequest8 executeRequest8) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest8); + return localVarResp.getData(); + } + + /** + * Create Recurring Payment + * Create a Recurring Payment via API + * @param executeRequest8 Create Recurring Payment Request (required) + * @return ApiResponse<UnitRecurringPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest8 executeRequest8) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest8, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Recurring Payment (asynchronously) + * Create a Recurring Payment via API + * @param executeRequest8 Create Recurring Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest8 executeRequest8, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest8, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateRewardApi.java b/src/main/java/org/openapitools/client/api/CreateRewardApi.java new file mode 100644 index 00000000..706a3d71 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateRewardApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest12; +import org.openapitools.client.model.UnitRewardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateRewardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateRewardApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateRewardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param executeRequest12 Create Reward Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteRequest12 executeRequest12, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest12; + + // create path and map variables + String localVarPath = "/rewards"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteRequest12 executeRequest12, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'executeRequest12' is set + if (executeRequest12 == null) { + throw new ApiException("Missing the required parameter 'executeRequest12' when calling execute(Async)"); + } + + return executeCall(executeRequest12, _callback); + + } + + /** + * Create Reward + * Create a Reward via API + * @param executeRequest12 Create Reward Request (required) + * @return UnitRewardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitRewardResponse execute(ExecuteRequest12 executeRequest12) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(executeRequest12); + return localVarResp.getData(); + } + + /** + * Create Reward + * Create a Reward via API + * @param executeRequest12 Create Reward Request (required) + * @return ApiResponse<UnitRewardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ExecuteRequest12 executeRequest12) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest12, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Reward (asynchronously) + * Create a Reward via API + * @param executeRequest12 Create Reward Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteRequest12 executeRequest12, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(executeRequest12, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/CreateWebhookApi.java b/src/main/java/org/openapitools/client/api/CreateWebhookApi.java new file mode 100644 index 00000000..f7cc3672 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/CreateWebhookApi.java @@ -0,0 +1,199 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.CreateWebhook; +import org.openapitools.client.model.UnitWebhookResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateWebhookApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CreateWebhookApi() { + this(Configuration.getDefaultApiClient()); + } + + public CreateWebhookApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param createWebhook Create Webhook Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(CreateWebhook createWebhook, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createWebhook; + + // create path and map variables + String localVarPath = "/webhooks"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(CreateWebhook createWebhook, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createWebhook' is set + if (createWebhook == null) { + throw new ApiException("Missing the required parameter 'createWebhook' when calling execute(Async)"); + } + + return executeCall(createWebhook, _callback); + + } + + /** + * Create Webhook + * Create a Webhook via API + * @param createWebhook Create Webhook Request (required) + * @return UnitWebhookResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitWebhookResponse execute(CreateWebhook createWebhook) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(createWebhook); + return localVarResp.getData(); + } + + /** + * Create Webhook + * Create a Webhook via API + * @param createWebhook Create Webhook Request (required) + * @return ApiResponse<UnitWebhookResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(CreateWebhook createWebhook) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(createWebhook, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Webhook (asynchronously) + * Create a Webhook via API + * @param createWebhook Create Webhook Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(CreateWebhook createWebhook, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(createWebhook, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DeactivateControlAgreementForAccountApi.java b/src/main/java/org/openapitools/client/api/DeactivateControlAgreementForAccountApi.java new file mode 100644 index 00000000..11b94e20 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DeactivateControlAgreementForAccountApi.java @@ -0,0 +1,202 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeactivateControlAgreementForAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DeactivateControlAgreementForAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public DeactivateControlAgreementForAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
404 -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/deactivate-daca" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Deactivate Account Control Agreement by Id + * Deactivate Control Agreement for Account via API + * @param accountId ID of the account (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
404 -
+ */ + public UnitAccountResponse execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Deactivate Account Control Agreement by Id + * Deactivate Control Agreement for Account via API + * @param accountId ID of the account (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
404 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Deactivate Account Control Agreement by Id (asynchronously) + * Deactivate Control Agreement for Account via API + * @param accountId ID of the account (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
404 -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DeclineAuthorizationRequestApi.java b/src/main/java/org/openapitools/client/api/DeclineAuthorizationRequestApi.java new file mode 100644 index 00000000..8b819e67 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DeclineAuthorizationRequestApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest11; +import org.openapitools.client.model.UnitAuthorizationRequestResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeclineAuthorizationRequestApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DeclineAuthorizationRequestApi() { + this(Configuration.getDefaultApiClient()); + } + + public DeclineAuthorizationRequestApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param authorizationId ID of the authorization request to decline (required) + * @param executeRequest11 Decline Authorization Request Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String authorizationId, ExecuteRequest11 executeRequest11, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest11; + + // create path and map variables + String localVarPath = "/authorization-requests/{authorizationId}/decline" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String authorizationId, ExecuteRequest11 executeRequest11, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest11' is set + if (executeRequest11 == null) { + throw new ApiException("Missing the required parameter 'executeRequest11' when calling execute(Async)"); + } + + return executeCall(authorizationId, executeRequest11, _callback); + + } + + /** + * Decline Authorization Request + * Decline Authorization Request via API + * @param authorizationId ID of the authorization request to decline (required) + * @param executeRequest11 Decline Authorization Request Request (required) + * @return UnitAuthorizationRequestResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitAuthorizationRequestResponse execute(String authorizationId, ExecuteRequest11 executeRequest11) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(authorizationId, executeRequest11); + return localVarResp.getData(); + } + + /** + * Decline Authorization Request + * Decline Authorization Request via API + * @param authorizationId ID of the authorization request to decline (required) + * @param executeRequest11 Decline Authorization Request Request (required) + * @return ApiResponse<UnitAuthorizationRequestResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String authorizationId, ExecuteRequest11 executeRequest11) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, executeRequest11, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Decline Authorization Request (asynchronously) + * Decline Authorization Request via API + * @param authorizationId ID of the authorization request to decline (required) + * @param executeRequest11 Decline Authorization Request Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String authorizationId, ExecuteRequest11 executeRequest11, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, executeRequest11, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DefaultApi.java b/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 00000000..545fc3fa --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,715 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.CreateStopPayment; +import org.openapitools.client.model.ExecuteFilterParameter20; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.StopPaymentListResponse; +import org.openapitools.client.model.StopPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter20 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/stop-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter20 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get a list of stop payments + * + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return StopPaymentListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public StopPaymentListResponse execute(ListPageParametersObject page, ExecuteFilterParameter20 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get a list of stop payments + * + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<StopPaymentListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter20 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of stop payments (asynchronously) + * + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter20 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for execute_0 + * @param createStopPayment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call execute_0Call(CreateStopPayment createStopPayment, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createStopPayment; + + // create path and map variables + String localVarPath = "/stop-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call execute_0ValidateBeforeCall(CreateStopPayment createStopPayment, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createStopPayment' is set + if (createStopPayment == null) { + throw new ApiException("Missing the required parameter 'createStopPayment' when calling execute_0(Async)"); + } + + return execute_0Call(createStopPayment, _callback); + + } + + /** + * Create a new stop payment + * + * @param createStopPayment (required) + * @return StopPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public StopPaymentResponse execute_0(CreateStopPayment createStopPayment) throws ApiException { + ApiResponse localVarResp = execute_0WithHttpInfo(createStopPayment); + return localVarResp.getData(); + } + + /** + * Create a new stop payment + * + * @param createStopPayment (required) + * @return ApiResponse<StopPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse execute_0WithHttpInfo(CreateStopPayment createStopPayment) throws ApiException { + okhttp3.Call localVarCall = execute_0ValidateBeforeCall(createStopPayment, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new stop payment (asynchronously) + * + * @param createStopPayment (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call execute_0Async(CreateStopPayment createStopPayment, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = execute_0ValidateBeforeCall(createStopPayment, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for execute_1 + * @param stopPaymentId ID of the stop payment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public okhttp3.Call execute_1Call(String stopPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/stop-payments/{stop_payment_id}" + .replace("{" + "stop_payment_id" + "}", localVarApiClient.escapeString(stopPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call execute_1ValidateBeforeCall(String stopPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stopPaymentId' is set + if (stopPaymentId == null) { + throw new ApiException("Missing the required parameter 'stopPaymentId' when calling execute_1(Async)"); + } + + return execute_1Call(stopPaymentId, _callback); + + } + + /** + * Get details of a specific stop payment + * + * @param stopPaymentId ID of the stop payment (required) + * @return StopPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public StopPaymentResponse execute_1(String stopPaymentId) throws ApiException { + ApiResponse localVarResp = execute_1WithHttpInfo(stopPaymentId); + return localVarResp.getData(); + } + + /** + * Get details of a specific stop payment + * + * @param stopPaymentId ID of the stop payment (required) + * @return ApiResponse<StopPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public ApiResponse execute_1WithHttpInfo(String stopPaymentId) throws ApiException { + okhttp3.Call localVarCall = execute_1ValidateBeforeCall(stopPaymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details of a specific stop payment (asynchronously) + * + * @param stopPaymentId ID of the stop payment (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public okhttp3.Call execute_1Async(String stopPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = execute_1ValidateBeforeCall(stopPaymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for execute_2 + * @param stopPaymentId ID of the stop payment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
204 Stop payment successfully canceled -
404 Stop payment not found -
+ */ + public okhttp3.Call execute_2Call(String stopPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/stop-payments/{stop_payment_id}" + .replace("{" + "stop_payment_id" + "}", localVarApiClient.escapeString(stopPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call execute_2ValidateBeforeCall(String stopPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stopPaymentId' is set + if (stopPaymentId == null) { + throw new ApiException("Missing the required parameter 'stopPaymentId' when calling execute_2(Async)"); + } + + return execute_2Call(stopPaymentId, _callback); + + } + + /** + * Cancel a stop payment + * + * @param stopPaymentId ID of the stop payment (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 Stop payment successfully canceled -
404 Stop payment not found -
+ */ + public void execute_2(String stopPaymentId) throws ApiException { + execute_2WithHttpInfo(stopPaymentId); + } + + /** + * Cancel a stop payment + * + * @param stopPaymentId ID of the stop payment (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 Stop payment successfully canceled -
404 Stop payment not found -
+ */ + public ApiResponse execute_2WithHttpInfo(String stopPaymentId) throws ApiException { + okhttp3.Call localVarCall = execute_2ValidateBeforeCall(stopPaymentId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Cancel a stop payment (asynchronously) + * + * @param stopPaymentId ID of the stop payment (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
204 Stop payment successfully canceled -
404 Stop payment not found -
+ */ + public okhttp3.Call execute_2Async(String stopPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = execute_2ValidateBeforeCall(stopPaymentId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for execute_3 + * @param stopPaymentId ID of the stop payment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public okhttp3.Call execute_3Call(String stopPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/stop-payments/{stop_payment_id}/disable" + .replace("{" + "stop_payment_id" + "}", localVarApiClient.escapeString(stopPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call execute_3ValidateBeforeCall(String stopPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stopPaymentId' is set + if (stopPaymentId == null) { + throw new ApiException("Missing the required parameter 'stopPaymentId' when calling execute_3(Async)"); + } + + return execute_3Call(stopPaymentId, _callback); + + } + + /** + * Disable a stop payment + * + * @param stopPaymentId ID of the stop payment (required) + * @return StopPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public StopPaymentResponse execute_3(String stopPaymentId) throws ApiException { + ApiResponse localVarResp = execute_3WithHttpInfo(stopPaymentId); + return localVarResp.getData(); + } + + /** + * Disable a stop payment + * + * @param stopPaymentId ID of the stop payment (required) + * @return ApiResponse<StopPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public ApiResponse execute_3WithHttpInfo(String stopPaymentId) throws ApiException { + okhttp3.Call localVarCall = execute_3ValidateBeforeCall(stopPaymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Disable a stop payment (asynchronously) + * + * @param stopPaymentId ID of the stop payment (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
404 Stop payment not found -
+ */ + public okhttp3.Call execute_3Async(String stopPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = execute_3ValidateBeforeCall(stopPaymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DeleteCounterpartyApi.java b/src/main/java/org/openapitools/client/api/DeleteCounterpartyApi.java new file mode 100644 index 00000000..d1bcb5b8 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DeleteCounterpartyApi.java @@ -0,0 +1,192 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeleteCounterpartyApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DeleteCounterpartyApi() { + this(Configuration.getDefaultApiClient()); + } + + public DeleteCounterpartyApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param counterpartyId ID of the counterparty to delete (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
204 Successful Response -
+ */ + public okhttp3.Call executeCall(String counterpartyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/counterparties/{counterpartyId}" + .replace("{" + "counterpartyId" + "}", localVarApiClient.escapeString(counterpartyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String counterpartyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'counterpartyId' is set + if (counterpartyId == null) { + throw new ApiException("Missing the required parameter 'counterpartyId' when calling execute(Async)"); + } + + return executeCall(counterpartyId, _callback); + + } + + /** + * Delete Counterparty by Id + * Delete Counterparty via API + * @param counterpartyId ID of the counterparty to delete (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
204 Successful Response -
+ */ + public void execute(String counterpartyId) throws ApiException { + executeWithHttpInfo(counterpartyId); + } + + /** + * Delete Counterparty by Id + * Delete Counterparty via API + * @param counterpartyId ID of the counterparty to delete (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
204 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String counterpartyId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Counterparty by Id (asynchronously) + * Delete Counterparty via API + * @param counterpartyId ID of the counterparty to delete (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
204 Successful Response -
+ */ + public okhttp3.Call executeAsync(String counterpartyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DisableRecurringPaymentApi.java b/src/main/java/org/openapitools/client/api/DisableRecurringPaymentApi.java new file mode 100644 index 00000000..a3b9378e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DisableRecurringPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitRecurringPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DisableRecurringPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DisableRecurringPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public DisableRecurringPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to disable (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/recurring-payments/{paymentId}/disable" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, _callback); + + } + + /** + * Disable Recurring Payment + * Disable Recurring Payment via API + * @param paymentId ID of the payment to disable (required) + * @return UnitRecurringPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRecurringPaymentResponse execute(String paymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId); + return localVarResp.getData(); + } + + /** + * Disable Recurring Payment + * Disable Recurring Payment via API + * @param paymentId ID of the payment to disable (required) + * @return ApiResponse<UnitRecurringPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Disable Recurring Payment (asynchronously) + * Disable Recurring Payment via API + * @param paymentId ID of the payment to disable (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DisableWebhookApi.java b/src/main/java/org/openapitools/client/api/DisableWebhookApi.java new file mode 100644 index 00000000..f69be876 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DisableWebhookApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitWebhookResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DisableWebhookApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DisableWebhookApi() { + this(Configuration.getDefaultApiClient()); + } + + public DisableWebhookApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param webhookId ID of the webhook to disable (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String webhookId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/webhooks/{webhookId}/disable" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String webhookId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException("Missing the required parameter 'webhookId' when calling execute(Async)"); + } + + return executeCall(webhookId, _callback); + + } + + /** + * Disable a Webhook + * Disable a Webhook via API + * @param webhookId ID of the webhook to disable (required) + * @return UnitWebhookResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitWebhookResponse execute(String webhookId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(webhookId); + return localVarResp.getData(); + } + + /** + * Disable a Webhook + * Disable a Webhook via API + * @param webhookId ID of the webhook to disable (required) + * @return ApiResponse<UnitWebhookResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String webhookId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Disable a Webhook (asynchronously) + * Disable a Webhook via API + * @param webhookId ID of the webhook to disable (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String webhookId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DownloadADocumentApi.java b/src/main/java/org/openapitools/client/api/DownloadADocumentApi.java new file mode 100644 index 00000000..44013bab --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DownloadADocumentApi.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DownloadADocumentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DownloadADocumentApi() { + this(Configuration.getDefaultApiClient()); + } + + public DownloadADocumentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/download" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, _callback); + + } + + /** + * Download a Document + * Download a Document via API + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public File execute(String applicationId, String documentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId); + return localVarResp.getData(); + } + + /** + * Download a Document + * Download a Document via API + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Download a Document (asynchronously) + * Download a Document via API + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/DownloadADocumentBackSideApi.java b/src/main/java/org/openapitools/client/api/DownloadADocumentBackSideApi.java new file mode 100644 index 00000000..40aead3e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/DownloadADocumentBackSideApi.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DownloadADocumentBackSideApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DownloadADocumentBackSideApi() { + this(Configuration.getDefaultApiClient()); + } + + public DownloadADocumentBackSideApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/download/back" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/octet-stream" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, _callback); + + } + + /** + * Download a Document - Back Side + * Download a Document - Back Side via API + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public File execute(String applicationId, String documentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId); + return localVarResp.getData(); + } + + /** + * Download a Document - Back Side + * Download a Document - Back Side via API + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Download a Document - Back Side (asynchronously) + * Download a Document - Back Side via API + * @param applicationId ID of the application (required) + * @param documentId ID of the document to download (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/EnableRecurringPaymentApi.java b/src/main/java/org/openapitools/client/api/EnableRecurringPaymentApi.java new file mode 100644 index 00000000..06662310 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/EnableRecurringPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitRecurringPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class EnableRecurringPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public EnableRecurringPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public EnableRecurringPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to enable (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/recurring-payments/{paymentId}/enable" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, _callback); + + } + + /** + * Enable Recurring Payment + * Enable Recurring Payment via API + * @param paymentId ID of the payment to enable (required) + * @return UnitRecurringPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRecurringPaymentResponse execute(String paymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId); + return localVarResp.getData(); + } + + /** + * Enable Recurring Payment + * Enable Recurring Payment via API + * @param paymentId ID of the payment to enable (required) + * @return ApiResponse<UnitRecurringPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Enable Recurring Payment (asynchronously) + * Enable Recurring Payment via API + * @param paymentId ID of the payment to enable (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/EnableWebhookApi.java b/src/main/java/org/openapitools/client/api/EnableWebhookApi.java new file mode 100644 index 00000000..837dcde6 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/EnableWebhookApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitWebhookResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class EnableWebhookApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public EnableWebhookApi() { + this(Configuration.getDefaultApiClient()); + } + + public EnableWebhookApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param webhookId ID of the webhook to enable (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String webhookId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/webhooks/{webhookId}/enable" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String webhookId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException("Missing the required parameter 'webhookId' when calling execute(Async)"); + } + + return executeCall(webhookId, _callback); + + } + + /** + * Enable Webhook + * Enable a Webhook via API + * @param webhookId ID of the webhook to enable (required) + * @return UnitWebhookResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitWebhookResponse execute(String webhookId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(webhookId); + return localVarResp.getData(); + } + + /** + * Enable Webhook + * Enable a Webhook via API + * @param webhookId ID of the webhook to enable (required) + * @return ApiResponse<UnitWebhookResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String webhookId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Enable Webhook (asynchronously) + * Enable a Webhook via API + * @param webhookId ID of the webhook to enable (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String webhookId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/EnterControlAgreementForAccountApi.java b/src/main/java/org/openapitools/client/api/EnterControlAgreementForAccountApi.java new file mode 100644 index 00000000..a20f449c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/EnterControlAgreementForAccountApi.java @@ -0,0 +1,202 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class EnterControlAgreementForAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public EnterControlAgreementForAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public EnterControlAgreementForAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/enter-daca" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Enter Account Control Agreement by Id + * Enter Control Agreement for Account via API + * @param accountId ID of the account (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Enter Account Control Agreement by Id + * Enter Control Agreement for Account via API + * @param accountId ID of the account (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Enter Account Control Agreement by Id (asynchronously) + * Enter Control Agreement for Account via API + * @param accountId ID of the account (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/FireEventApi.java b/src/main/java/org/openapitools/client/api/FireEventApi.java new file mode 100644 index 00000000..4a4aacfb --- /dev/null +++ b/src/main/java/org/openapitools/client/api/FireEventApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitEventResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FireEventApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FireEventApi() { + this(Configuration.getDefaultApiClient()); + } + + public FireEventApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param eventId ID of the event to fire (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String eventId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/events/{eventId}" + .replace("{" + "eventId" + "}", localVarApiClient.escapeString(eventId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String eventId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'eventId' is set + if (eventId == null) { + throw new ApiException("Missing the required parameter 'eventId' when calling execute(Async)"); + } + + return executeCall(eventId, _callback); + + } + + /** + * Fire Event by Id + * Fire an Event via API + * @param eventId ID of the event to fire (required) + * @return UnitEventResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitEventResponse execute(String eventId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(eventId); + return localVarResp.getData(); + } + + /** + * Fire Event by Id + * Fire an Event via API + * @param eventId ID of the event to fire (required) + * @return ApiResponse<UnitEventResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String eventId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(eventId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Fire Event by Id (asynchronously) + * Fire an Event via API + * @param eventId ID of the event to fire (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String eventId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(eventId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/FreezeACardApi.java b/src/main/java/org/openapitools/client/api/FreezeACardApi.java new file mode 100644 index 00000000..77e9968c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/FreezeACardApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FreezeACardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FreezeACardApi() { + this(Configuration.getDefaultApiClient()); + } + + public FreezeACardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to freeze (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/freeze" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Freeze a Card + * Freeze a Card via API + * @param cardId ID of the card to freeze (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Freeze a Card + * Freeze a Card via API + * @param cardId ID of the card to freeze (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Freeze a Card (asynchronously) + * Freeze a Card via API + * @param cardId ID of the card to freeze (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/FreezeAnAccountApi.java b/src/main/java/org/openapitools/client/api/FreezeAnAccountApi.java new file mode 100644 index 00000000..2efdeaf2 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/FreezeAnAccountApi.java @@ -0,0 +1,213 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest3; +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FreezeAnAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FreezeAnAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public FreezeAnAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to freeze (required) + * @param executeRequest3 Freeze Account Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, ExecuteRequest3 executeRequest3, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest3; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/freeze" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, ExecuteRequest3 executeRequest3, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest3' is set + if (executeRequest3 == null) { + throw new ApiException("Missing the required parameter 'executeRequest3' when calling execute(Async)"); + } + + return executeCall(accountId, executeRequest3, _callback); + + } + + /** + * Freeze Account by Id + * Freeze Account via API + * @param accountId ID of the account to freeze (required) + * @param executeRequest3 Freeze Account Request (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId, ExecuteRequest3 executeRequest3) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId, executeRequest3); + return localVarResp.getData(); + } + + /** + * Freeze Account by Id + * Freeze Account via API + * @param accountId ID of the account to freeze (required) + * @param executeRequest3 Freeze Account Request (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId, ExecuteRequest3 executeRequest3) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, executeRequest3, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Freeze Account by Id (asynchronously) + * Freeze Account via API + * @param accountId ID of the account to freeze (required) + * @param executeRequest3 Freeze Account Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, ExecuteRequest3 executeRequest3, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, executeRequest3, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetABackImageApi.java b/src/main/java/org/openapitools/client/api/GetABackImageApi.java new file mode 100644 index 00000000..993dfcbd --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetABackImageApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetABackImageApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetABackImageApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetABackImageApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkPaymentId ID of the check payment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-payments/{checkPaymentId}/back" + .replace("{" + "checkPaymentId" + "}", localVarApiClient.escapeString(checkPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "image/png" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkPaymentId' is set + if (checkPaymentId == null) { + throw new ApiException("Missing the required parameter 'checkPaymentId' when calling execute(Async)"); + } + + return executeCall(checkPaymentId, _callback); + + } + + /** + * Get back image + * Get back image via API + * @param checkPaymentId ID of the check payment (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public File execute(String checkPaymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkPaymentId); + return localVarResp.getData(); + } + + /** + * Get back image + * Get back image via API + * @param checkPaymentId ID of the check payment (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkPaymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get back image (asynchronously) + * Get back image via API + * @param checkPaymentId ID of the check payment (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetAFrontImageApi.java b/src/main/java/org/openapitools/client/api/GetAFrontImageApi.java new file mode 100644 index 00000000..81091926 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetAFrontImageApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetAFrontImageApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetAFrontImageApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetAFrontImageApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkPaymentId ID of the check payment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-payments/{checkPaymentId}/front" + .replace("{" + "checkPaymentId" + "}", localVarApiClient.escapeString(checkPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "image/png" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkPaymentId' is set + if (checkPaymentId == null) { + throw new ApiException("Missing the required parameter 'checkPaymentId' when calling execute(Async)"); + } + + return executeCall(checkPaymentId, _callback); + + } + + /** + * Get front image + * Get front image via API + * @param checkPaymentId ID of the check payment (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public File execute(String checkPaymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkPaymentId); + return localVarResp.getData(); + } + + /** + * Get front image + * Get front image via API + * @param checkPaymentId ID of the check payment (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkPaymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get front image (asynchronously) + * Get front image via API + * @param checkPaymentId ID of the check payment (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetAccountApi.java b/src/main/java/org/openapitools/client/api/GetAccountApi.java new file mode 100644 index 00000000..1458fdef --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetAccountApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAccountResponseWithIncluded; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to get (required) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String accountId, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, String include, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, include, _callback); + + } + + /** + * Get Account by Id + * Get an Account from API + * @param accountId ID of the account to get (required) + * @param include (optional) + * @return UnitAccountResponseWithIncluded + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitAccountResponseWithIncluded execute(String accountId, String include) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId, include); + return localVarResp.getData(); + } + + /** + * Get Account by Id + * Get an Account from API + * @param accountId ID of the account to get (required) + * @param include (optional) + * @return ApiResponse<UnitAccountResponseWithIncluded> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String accountId, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, include, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Account by Id (asynchronously) + * Get an Account from API + * @param accountId ID of the account to get (required) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String accountId, String include, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, include, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetAccountLimitsApi.java b/src/main/java/org/openapitools/client/api/GetAccountLimitsApi.java new file mode 100644 index 00000000..087080d7 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetAccountLimitsApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitGetAccountLimitsResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetAccountLimitsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetAccountLimitsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetAccountLimitsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/limits" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Get Account Limits by Id + * Get Account Limits from API + * @param accountId ID of the account to get (required) + * @return UnitGetAccountLimitsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitGetAccountLimitsResponse execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Get Account Limits by Id + * Get Account Limits from API + * @param accountId ID of the account to get (required) + * @return ApiResponse<UnitGetAccountLimitsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Account Limits by Id (asynchronously) + * Get Account Limits from API + * @param accountId ID of the account to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetApplicationApi.java b/src/main/java/org/openapitools/client/api/GetApplicationApi.java new file mode 100644 index 00000000..0859e321 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetApplicationApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitApplicationResponseWithIncluded; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to get (required) + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/applications/{applicationId}" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String included, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + return executeCall(applicationId, included, _callback); + + } + + /** + * Get Application by Id + * Get an Application from API + * @param applicationId ID of the application to get (required) + * @param included (optional) + * @return UnitApplicationResponseWithIncluded + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitApplicationResponseWithIncluded execute(String applicationId, String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, included); + return localVarResp.getData(); + } + + /** + * Get Application by Id + * Get an Application from API + * @param applicationId ID of the application to get (required) + * @param included (optional) + * @return ApiResponse<UnitApplicationResponseWithIncluded> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Application by Id (asynchronously) + * Get an Application from API + * @param applicationId ID of the application to get (required) + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetApplicationFormApi.java b/src/main/java/org/openapitools/client/api/GetApplicationFormApi.java new file mode 100644 index 00000000..4db0f2bd --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetApplicationFormApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitApplicationFormResponseWithIncluded; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetApplicationFormApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetApplicationFormApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetApplicationFormApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationFormId ID of the application form to get (required) + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationFormId, String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/application-forms/{applicationFormId}" + .replace("{" + "applicationFormId" + "}", localVarApiClient.escapeString(applicationFormId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationFormId, String included, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationFormId' is set + if (applicationFormId == null) { + throw new ApiException("Missing the required parameter 'applicationFormId' when calling execute(Async)"); + } + + return executeCall(applicationFormId, included, _callback); + + } + + /** + * Get ApplicationForm by Id + * Get an Application Form from API + * @param applicationFormId ID of the application form to get (required) + * @param included (optional) + * @return UnitApplicationFormResponseWithIncluded + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitApplicationFormResponseWithIncluded execute(String applicationFormId, String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationFormId, included); + return localVarResp.getData(); + } + + /** + * Get ApplicationForm by Id + * Get an Application Form from API + * @param applicationFormId ID of the application form to get (required) + * @param included (optional) + * @return ApiResponse<UnitApplicationFormResponseWithIncluded> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationFormId, String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationFormId, included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get ApplicationForm by Id (asynchronously) + * Get an Application Form from API + * @param applicationFormId ID of the application form to get (required) + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationFormId, String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationFormId, included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetAtmLocationsListApi.java b/src/main/java/org/openapitools/client/api/GetAtmLocationsListApi.java new file mode 100644 index 00000000..27513e76 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetAtmLocationsListApi.java @@ -0,0 +1,196 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter15; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetAtmLocationsListApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetAtmLocationsListApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetAtmLocationsListApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param filter (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ExecuteFilterParameter15 filter, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/atm-locations"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ExecuteFilterParameter15 filter, final ApiCallback _callback) throws ApiException { + return executeCall(filter, _callback); + + } + + /** + * Get List ATM Locations + * Get List ATM Locations from API + * @param filter (optional) + * @return List<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public List execute(ExecuteFilterParameter15 filter) throws ApiException { + ApiResponse> localVarResp = executeWithHttpInfo(filter); + return localVarResp.getData(); + } + + /** + * Get List ATM Locations + * Get List ATM Locations from API + * @param filter (optional) + * @return ApiResponse<List<Object>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse> executeWithHttpInfo(ExecuteFilterParameter15 filter) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(filter, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List ATM Locations (asynchronously) + * Get List ATM Locations from API + * @param filter (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ExecuteFilterParameter15 filter, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(filter, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetAuthorizationApi.java b/src/main/java/org/openapitools/client/api/GetAuthorizationApi.java new file mode 100644 index 00000000..2e863d7d --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetAuthorizationApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAuthorizationResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetAuthorizationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetAuthorizationApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetAuthorizationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param authorizationId ID of the authorization to get (required) + * @param includeNoneAuthorized (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String authorizationId, Boolean includeNoneAuthorized, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations/{authorizationId}" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (includeNoneAuthorized != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("includeNoneAuthorized", includeNoneAuthorized)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String authorizationId, Boolean includeNoneAuthorized, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling execute(Async)"); + } + + return executeCall(authorizationId, includeNoneAuthorized, _callback); + + } + + /** + * Get Authorization by Id + * Get a Authorization from API + * @param authorizationId ID of the authorization to get (required) + * @param includeNoneAuthorized (optional) + * @return UnitAuthorizationResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitAuthorizationResponse execute(String authorizationId, Boolean includeNoneAuthorized) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(authorizationId, includeNoneAuthorized); + return localVarResp.getData(); + } + + /** + * Get Authorization by Id + * Get a Authorization from API + * @param authorizationId ID of the authorization to get (required) + * @param includeNoneAuthorized (optional) + * @return ApiResponse<UnitAuthorizationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String authorizationId, Boolean includeNoneAuthorized) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, includeNoneAuthorized, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Authorization by Id (asynchronously) + * Get a Authorization from API + * @param authorizationId ID of the authorization to get (required) + * @param includeNoneAuthorized (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String authorizationId, Boolean includeNoneAuthorized, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, includeNoneAuthorized, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetAuthorizationRequestApi.java b/src/main/java/org/openapitools/client/api/GetAuthorizationRequestApi.java new file mode 100644 index 00000000..fd6f0618 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetAuthorizationRequestApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAuthorizationRequestsResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetAuthorizationRequestApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetAuthorizationRequestApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetAuthorizationRequestApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param authorizationId ID of the authorization request to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String authorizationId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorization-requests/{authorizationId}" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String authorizationId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling execute(Async)"); + } + + return executeCall(authorizationId, _callback); + + } + + /** + * Get Authorization Request by Id + * Get a Authorization Request from API + * @param authorizationId ID of the authorization request to get (required) + * @return UnitAuthorizationRequestsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitAuthorizationRequestsResponse execute(String authorizationId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(authorizationId); + return localVarResp.getData(); + } + + /** + * Get Authorization Request by Id + * Get a Authorization Request from API + * @param authorizationId ID of the authorization request to get (required) + * @return ApiResponse<UnitAuthorizationRequestsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String authorizationId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Authorization Request by Id (asynchronously) + * Get a Authorization Request from API + * @param authorizationId ID of the authorization request to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String authorizationId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(authorizationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetBankVerificationPdfApi.java b/src/main/java/org/openapitools/client/api/GetBankVerificationPdfApi.java new file mode 100644 index 00000000..ed97875d --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetBankVerificationPdfApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetBankVerificationPdfApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetBankVerificationPdfApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetBankVerificationPdfApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/statements/{accountId}/bank/pdf" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/pdf" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Get Bank verification PDF + * Get Get Bank verification PDF from API + * @param accountId ID of the account to get (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public File execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Get Bank verification PDF + * Get Get Bank verification PDF from API + * @param accountId ID of the account to get (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Bank verification PDF (asynchronously) + * Get Get Bank verification PDF from API + * @param accountId ID of the account to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCardApi.java b/src/main/java/org/openapitools/client/api/GetCardApi.java new file mode 100644 index 00000000..2157f736 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCardApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse1; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCardApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to get (required) + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, String included, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, included, _callback); + + } + + /** + * Get Card by Id + * Get a Card from API + * @param cardId ID of the card to get (required) + * @param included (optional) + * @return UnitCardResponse1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse1 execute(String cardId, String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId, included); + return localVarResp.getData(); + } + + /** + * Get Card by Id + * Get a Card from API + * @param cardId ID of the card to get (required) + * @param included (optional) + * @return ApiResponse<UnitCardResponse1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId, String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Card by Id (asynchronously) + * Get a Card from API + * @param cardId ID of the card to get (required) + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCardLimitsApi.java b/src/main/java/org/openapitools/client/api/GetCardLimitsApi.java new file mode 100644 index 00000000..3aee2c88 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCardLimitsApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse3; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCardLimitsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCardLimitsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCardLimitsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/limits" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Get Card Limit by Id + * Get a Card Limits from API + * @param cardId ID of the card to get (required) + * @return UnitCardResponse3 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse3 execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Get Card Limit by Id + * Get a Card Limits from API + * @param cardId ID of the card to get (required) + * @return ApiResponse<UnitCardResponse3> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Card Limit by Id (asynchronously) + * Get a Card Limits from API + * @param cardId ID of the card to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCardPinStatusApi.java b/src/main/java/org/openapitools/client/api/GetCardPinStatusApi.java new file mode 100644 index 00000000..34df3d9c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCardPinStatusApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse2; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCardPinStatusApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCardPinStatusApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCardPinStatusApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to get PIN status (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/secure-data/pin/status" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Get Card PIN Status + * Get Card PIN Status via API + * @param cardId ID of the card to get PIN status (required) + * @return UnitCardResponse2 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse2 execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Get Card PIN Status + * Get Card PIN Status via API + * @param cardId ID of the card to get PIN status (required) + * @return ApiResponse<UnitCardResponse2> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Card PIN Status (asynchronously) + * Get Card PIN Status via API + * @param cardId ID of the card to get PIN status (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCheckDepositApi.java b/src/main/java/org/openapitools/client/api/GetCheckDepositApi.java new file mode 100644 index 00000000..066a3518 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCheckDepositApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckDepositResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCheckDepositApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCheckDepositApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCheckDepositApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkDepositId ID of the check deposit to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-deposits/{checkDepositId}" + .replace("{" + "checkDepositId" + "}", localVarApiClient.escapeString(checkDepositId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkDepositId' is set + if (checkDepositId == null) { + throw new ApiException("Missing the required parameter 'checkDepositId' when calling execute(Async)"); + } + + return executeCall(checkDepositId, _callback); + + } + + /** + * Get Check Deposit by Id + * Get a Check Deposit from API + * @param checkDepositId ID of the check deposit to get (required) + * @return UnitCheckDepositResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckDepositResponse execute(String checkDepositId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkDepositId); + return localVarResp.getData(); + } + + /** + * Get Check Deposit by Id + * Get a Check Deposit from API + * @param checkDepositId ID of the check deposit to get (required) + * @return ApiResponse<UnitCheckDepositResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkDepositId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Check Deposit by Id (asynchronously) + * Get a Check Deposit from API + * @param checkDepositId ID of the check deposit to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkDepositId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCheckDepositBackImageApi.java b/src/main/java/org/openapitools/client/api/GetCheckDepositBackImageApi.java new file mode 100644 index 00000000..9379b9c9 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCheckDepositBackImageApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckDepositResponse1; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCheckDepositBackImageApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCheckDepositBackImageApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCheckDepositBackImageApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkDepositId ID of the check deposit to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-deposits/{checkDepositId}/back" + .replace("{" + "checkDepositId" + "}", localVarApiClient.escapeString(checkDepositId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkDepositId' is set + if (checkDepositId == null) { + throw new ApiException("Missing the required parameter 'checkDepositId' when calling execute(Async)"); + } + + return executeCall(checkDepositId, _callback); + + } + + /** + * Get Back Check Deposit Image by Id + * Get Back Check Deposit Image from API + * @param checkDepositId ID of the check deposit to get (required) + * @return UnitCheckDepositResponse1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckDepositResponse1 execute(String checkDepositId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkDepositId); + return localVarResp.getData(); + } + + /** + * Get Back Check Deposit Image by Id + * Get Back Check Deposit Image from API + * @param checkDepositId ID of the check deposit to get (required) + * @return ApiResponse<UnitCheckDepositResponse1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkDepositId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Back Check Deposit Image by Id (asynchronously) + * Get Back Check Deposit Image from API + * @param checkDepositId ID of the check deposit to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkDepositId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCheckDepositFrontImageApi.java b/src/main/java/org/openapitools/client/api/GetCheckDepositFrontImageApi.java new file mode 100644 index 00000000..aabfc756 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCheckDepositFrontImageApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckDepositResponse1; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCheckDepositFrontImageApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCheckDepositFrontImageApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCheckDepositFrontImageApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkDepositId ID of the check deposit to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-deposits/{checkDepositId}/front" + .replace("{" + "checkDepositId" + "}", localVarApiClient.escapeString(checkDepositId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkDepositId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkDepositId' is set + if (checkDepositId == null) { + throw new ApiException("Missing the required parameter 'checkDepositId' when calling execute(Async)"); + } + + return executeCall(checkDepositId, _callback); + + } + + /** + * Get Front Check Deposit Image by Id + * Get Front Check Deposit Image from API + * @param checkDepositId ID of the check deposit to get (required) + * @return UnitCheckDepositResponse1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckDepositResponse1 execute(String checkDepositId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkDepositId); + return localVarResp.getData(); + } + + /** + * Get Front Check Deposit Image by Id + * Get Front Check Deposit Image from API + * @param checkDepositId ID of the check deposit to get (required) + * @return ApiResponse<UnitCheckDepositResponse1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkDepositId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Front Check Deposit Image by Id (asynchronously) + * Get Front Check Deposit Image from API + * @param checkDepositId ID of the check deposit to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkDepositId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCheckPaymentApi.java b/src/main/java/org/openapitools/client/api/GetCheckPaymentApi.java new file mode 100644 index 00000000..852ffb84 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCheckPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCheckPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCheckPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCheckPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkPaymentId ID of the check payment to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-payments/{checkPaymentId}" + .replace("{" + "checkPaymentId" + "}", localVarApiClient.escapeString(checkPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkPaymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkPaymentId' is set + if (checkPaymentId == null) { + throw new ApiException("Missing the required parameter 'checkPaymentId' when calling execute(Async)"); + } + + return executeCall(checkPaymentId, _callback); + + } + + /** + * Get Check Payment by Id + * Get a Check Payment from API + * @param checkPaymentId ID of the check payment to get (required) + * @return UnitCheckPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckPaymentResponse execute(String checkPaymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkPaymentId); + return localVarResp.getData(); + } + + /** + * Get Check Payment by Id + * Get a Check Payment from API + * @param checkPaymentId ID of the check payment to get (required) + * @return ApiResponse<UnitCheckPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkPaymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Check Payment by Id (asynchronously) + * Get a Check Payment from API + * @param checkPaymentId ID of the check payment to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkPaymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCounterpartyApi.java b/src/main/java/org/openapitools/client/api/GetCounterpartyApi.java new file mode 100644 index 00000000..44a72a9d --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCounterpartyApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCounterpartyResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCounterpartyApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCounterpartyApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCounterpartyApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param counterpartyId ID of the counterparty to get (required) + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String counterpartyId, String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/counterparties/{counterpartyId}" + .replace("{" + "counterpartyId" + "}", localVarApiClient.escapeString(counterpartyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String counterpartyId, String included, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'counterpartyId' is set + if (counterpartyId == null) { + throw new ApiException("Missing the required parameter 'counterpartyId' when calling execute(Async)"); + } + + return executeCall(counterpartyId, included, _callback); + + } + + /** + * Get Counterparty by Id + * Get a Counterparty from API + * @param counterpartyId ID of the counterparty to get (required) + * @param included (optional) + * @return UnitCounterpartyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCounterpartyResponse execute(String counterpartyId, String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(counterpartyId, included); + return localVarResp.getData(); + } + + /** + * Get Counterparty by Id + * Get a Counterparty from API + * @param counterpartyId ID of the counterparty to get (required) + * @param included (optional) + * @return ApiResponse<UnitCounterpartyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String counterpartyId, String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Counterparty by Id (asynchronously) + * Get a Counterparty from API + * @param counterpartyId ID of the counterparty to get (required) + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String counterpartyId, String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCounterpartyBalanceApi.java b/src/main/java/org/openapitools/client/api/GetCounterpartyBalanceApi.java new file mode 100644 index 00000000..2e703337 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCounterpartyBalanceApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCounterpartyResponse1; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCounterpartyBalanceApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCounterpartyBalanceApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCounterpartyBalanceApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param counterpartyId ID of the counterparty to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String counterpartyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/counterparties/{counterpartyId}/balance" + .replace("{" + "counterpartyId" + "}", localVarApiClient.escapeString(counterpartyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String counterpartyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'counterpartyId' is set + if (counterpartyId == null) { + throw new ApiException("Missing the required parameter 'counterpartyId' when calling execute(Async)"); + } + + return executeCall(counterpartyId, _callback); + + } + + /** + * Get Counterparty Balance + * Get Recurring Payment from API + * @param counterpartyId ID of the counterparty to get (required) + * @return UnitCounterpartyResponse1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCounterpartyResponse1 execute(String counterpartyId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(counterpartyId); + return localVarResp.getData(); + } + + /** + * Get Counterparty Balance + * Get Recurring Payment from API + * @param counterpartyId ID of the counterparty to get (required) + * @return ApiResponse<UnitCounterpartyResponse1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String counterpartyId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Counterparty Balance (asynchronously) + * Get Recurring Payment from API + * @param counterpartyId ID of the counterparty to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String counterpartyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetCustomerApi.java b/src/main/java/org/openapitools/client/api/GetCustomerApi.java new file mode 100644 index 00000000..898d7a45 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetCustomerApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCustomerResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetCustomerApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetCustomerApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetCustomerApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param customerId ID of the customer to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String customerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/customers/{customerId}" + .replace("{" + "customerId" + "}", localVarApiClient.escapeString(customerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String customerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerId' is set + if (customerId == null) { + throw new ApiException("Missing the required parameter 'customerId' when calling execute(Async)"); + } + + return executeCall(customerId, _callback); + + } + + /** + * Get Customer by Id + * Get a Customer from API + * @param customerId ID of the customer to get (required) + * @return UnitCustomerResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCustomerResponse execute(String customerId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(customerId); + return localVarResp.getData(); + } + + /** + * Get Customer by Id + * Get a Customer from API + * @param customerId ID of the customer to get (required) + * @return ApiResponse<UnitCustomerResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String customerId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Customer by Id (asynchronously) + * Get a Customer from API + * @param customerId ID of the customer to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String customerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetDisputeApi.java b/src/main/java/org/openapitools/client/api/GetDisputeApi.java new file mode 100644 index 00000000..6a9b3a60 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetDisputeApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDisputeResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetDisputeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetDisputeApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetDisputeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param disputeId ID of the dispute to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String disputeId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/disputes/{disputeId}" + .replace("{" + "disputeId" + "}", localVarApiClient.escapeString(disputeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String disputeId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'disputeId' is set + if (disputeId == null) { + throw new ApiException("Missing the required parameter 'disputeId' when calling execute(Async)"); + } + + return executeCall(disputeId, _callback); + + } + + /** + * Get Dispute by Id + * Get a Dispute from API + * @param disputeId ID of the dispute to get (required) + * @return UnitDisputeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDisputeResponse execute(String disputeId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(disputeId); + return localVarResp.getData(); + } + + /** + * Get Dispute by Id + * Get a Dispute from API + * @param disputeId ID of the dispute to get (required) + * @return ApiResponse<UnitDisputeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String disputeId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(disputeId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Dispute by Id (asynchronously) + * Get a Dispute from API + * @param disputeId ID of the dispute to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String disputeId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(disputeId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetEventApi.java b/src/main/java/org/openapitools/client/api/GetEventApi.java new file mode 100644 index 00000000..91e14c2e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetEventApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitEventResponse1; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetEventApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetEventApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetEventApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param eventId ID of the event to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String eventId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/events/{eventId}" + .replace("{" + "eventId" + "}", localVarApiClient.escapeString(eventId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String eventId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'eventId' is set + if (eventId == null) { + throw new ApiException("Missing the required parameter 'eventId' when calling execute(Async)"); + } + + return executeCall(eventId, _callback); + + } + + /** + * Get Event by Id + * Get an Event from API + * @param eventId ID of the event to get (required) + * @return UnitEventResponse1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitEventResponse1 execute(String eventId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(eventId); + return localVarResp.getData(); + } + + /** + * Get Event by Id + * Get an Event from API + * @param eventId ID of the event to get (required) + * @return ApiResponse<UnitEventResponse1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String eventId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(eventId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Event by Id (asynchronously) + * Get an Event from API + * @param eventId ID of the event to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String eventId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(eventId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetInstitutionApi.java b/src/main/java/org/openapitools/client/api/GetInstitutionApi.java new file mode 100644 index 00000000..d22cbf7e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetInstitutionApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitInstitutionResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetInstitutionApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetInstitutionApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetInstitutionApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param routingNumber routingNumber of the institution to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String routingNumber, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/institutions/{routingNumber}" + .replace("{" + "routingNumber" + "}", localVarApiClient.escapeString(routingNumber.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String routingNumber, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'routingNumber' is set + if (routingNumber == null) { + throw new ApiException("Missing the required parameter 'routingNumber' when calling execute(Async)"); + } + + return executeCall(routingNumber, _callback); + + } + + /** + * Get Institution by Routing Number + * Get an Institution from API + * @param routingNumber routingNumber of the institution to get (required) + * @return UnitInstitutionResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitInstitutionResponse execute(String routingNumber) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(routingNumber); + return localVarResp.getData(); + } + + /** + * Get Institution by Routing Number + * Get an Institution from API + * @param routingNumber routingNumber of the institution to get (required) + * @return ApiResponse<UnitInstitutionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String routingNumber) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(routingNumber, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Institution by Routing Number (asynchronously) + * Get an Institution from API + * @param routingNumber routingNumber of the institution to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String routingNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(routingNumber, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListAccountEndOfDayBalancesHistoryApi.java b/src/main/java/org/openapitools/client/api/GetListAccountEndOfDayBalancesHistoryApi.java new file mode 100644 index 00000000..ac30a51b --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListAccountEndOfDayBalancesHistoryApi.java @@ -0,0 +1,192 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitGetAccountEndOfDayListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListAccountEndOfDayBalancesHistoryApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListAccountEndOfDayBalancesHistoryApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListAccountEndOfDayBalancesHistoryApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/account-end-of-day"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return executeCall(_callback); + + } + + /** + * Get AccountEndOfDay List + * Get AccountEndOfDay List from API + * @return UnitGetAccountEndOfDayListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitGetAccountEndOfDayListResponse execute() throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get AccountEndOfDay List + * Get AccountEndOfDay List from API + * @return ApiResponse<UnitGetAccountEndOfDayListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get AccountEndOfDay List (asynchronously) + * Get AccountEndOfDay List from API + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListAccountsApi.java b/src/main/java/org/openapitools/client/api/GetListAccountsApi.java new file mode 100644 index 00000000..9cc33050 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListAccountsApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter2; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitAccountsListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListAccountsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListAccountsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListAccountsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter2 filter, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter2 filter, String include, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, include, _callback); + + } + + /** + * Get List Accounts + * Get List Accounts from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @return UnitAccountsListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public UnitAccountsListResponse execute(ListPageParametersObject page, ExecuteFilterParameter2 filter, String include) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, include); + return localVarResp.getData(); + } + + /** + * Get List Accounts + * Get List Accounts from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @return ApiResponse<UnitAccountsListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter2 filter, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, include, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Accounts (asynchronously) + * Get List Accounts from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter2 filter, String include, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, include, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListApplicationFormsApi.java b/src/main/java/org/openapitools/client/api/GetListApplicationFormsApi.java new file mode 100644 index 00000000..42966422 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListApplicationFormsApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter1; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitApplicationFormsListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListApplicationFormsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListApplicationFormsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListApplicationFormsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter1 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/application-forms"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter1 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get List Application Forms + * Get List Application Forms from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitApplicationFormsListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitApplicationFormsListResponse execute(ListPageParametersObject page, ExecuteFilterParameter1 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get List Application Forms + * Get List Application Forms from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitApplicationFormsListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter1 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Application Forms (asynchronously) + * Get List Application Forms from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter1 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListApplicationsApi.java b/src/main/java/org/openapitools/client/api/GetListApplicationsApi.java new file mode 100644 index 00000000..d86fe578 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListApplicationsApi.java @@ -0,0 +1,219 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitListApplicationsResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListApplicationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListApplicationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListApplicationsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 Unexpected error -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/applications"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get List Application + * Get List Applications from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitListApplicationsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 Unexpected error -
+ */ + public UnitListApplicationsResponse execute(ListPageParametersObject page, ExecuteFilterParameter filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get List Application + * Get List Applications from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitListApplicationsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 Unexpected error -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Application (asynchronously) + * Get List Applications from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListAuthorizationRequestsApi.java b/src/main/java/org/openapitools/client/api/GetListAuthorizationRequestsApi.java new file mode 100644 index 00000000..367cfd0a --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListAuthorizationRequestsApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Execute200Response2; +import org.openapitools.client.model.ExecuteFilterParameter9; +import org.openapitools.client.model.ListPageParametersObject; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListAuthorizationRequestsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListAuthorizationRequestsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListAuthorizationRequestsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter9 filter, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorization-requests"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter9 filter, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, _callback); + + } + + /** + * Get List Authorization Requests + * Get List Authorization Requests from API + * @param page (optional) + * @param filter (optional) + * @return Execute200Response2 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public Execute200Response2 execute(ListPageParametersObject page, ExecuteFilterParameter9 filter) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter); + return localVarResp.getData(); + } + + /** + * Get List Authorization Requests + * Get List Authorization Requests from API + * @param page (optional) + * @param filter (optional) + * @return ApiResponse<Execute200Response2> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter9 filter) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Authorization Requests (asynchronously) + * Get List Authorization Requests from API + * @param page (optional) + * @param filter (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter9 filter, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListAuthorizationsApi.java b/src/main/java/org/openapitools/client/api/GetListAuthorizationsApi.java new file mode 100644 index 00000000..77ae0d9e --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListAuthorizationsApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Execute200Response1; +import org.openapitools.client.model.ExecuteFilterParameter8; +import org.openapitools.client.model.ListPageParametersObject; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListAuthorizationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListAuthorizationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListAuthorizationsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter8 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter8 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get List authorizations + * Get List Authorizations from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return Execute200Response1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public Execute200Response1 execute(ListPageParametersObject page, ExecuteFilterParameter8 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get List authorizations + * Get List Authorizations from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<Execute200Response1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter8 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List authorizations (asynchronously) + * Get List Authorizations from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter8 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListCheckDepositsApi.java b/src/main/java/org/openapitools/client/api/GetListCheckDepositsApi.java new file mode 100644 index 00000000..b38e63a9 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListCheckDepositsApi.java @@ -0,0 +1,222 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.CheckDeposit; +import org.openapitools.client.model.ExecuteFilterParameter13; +import org.openapitools.client.model.ListPageParametersObject; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListCheckDepositsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListCheckDepositsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListCheckDepositsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter13 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-deposits"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter13 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, include, _callback); + + } + + /** + * Get List Check Deposits + * Get List Check Deposits from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return List<CheckDeposit> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public List execute(ListPageParametersObject page, ExecuteFilterParameter13 filter, String sort, String include) throws ApiException { + ApiResponse> localVarResp = executeWithHttpInfo(page, filter, sort, include); + return localVarResp.getData(); + } + + /** + * Get List Check Deposits + * Get List Check Deposits from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return ApiResponse<List<CheckDeposit>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse> executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter13 filter, String sort, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Check Deposits (asynchronously) + * Get List Check Deposits from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter13 filter, String sort, String include, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListCheckPaymentsApi.java b/src/main/java/org/openapitools/client/api/GetListCheckPaymentsApi.java new file mode 100644 index 00000000..54c57777 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListCheckPaymentsApi.java @@ -0,0 +1,222 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Execute200Response3; +import org.openapitools.client.model.ExecuteFilterParameter19; +import org.openapitools.client.model.ListPageParametersObject; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListCheckPaymentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListCheckPaymentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListCheckPaymentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter19 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/check-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter19 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, include, _callback); + + } + + /** + * Get List Check Payments + * Get List Check Payments from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return Execute200Response3 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public Execute200Response3 execute(ListPageParametersObject page, ExecuteFilterParameter19 filter, String sort, String include) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort, include); + return localVarResp.getData(); + } + + /** + * Get List Check Payments + * Get List Check Payments from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return ApiResponse<Execute200Response3> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter19 filter, String sort, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Check Payments (asynchronously) + * Get List Check Payments from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter19 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListCounterpartiesApi.java b/src/main/java/org/openapitools/client/api/GetListCounterpartiesApi.java new file mode 100644 index 00000000..76697940 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListCounterpartiesApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter5; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitCounterpartiesListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListCounterpartiesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListCounterpartiesApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListCounterpartiesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter5 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/counterparties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter5 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get Counterparties List + * Get Counterparties List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitCounterpartiesListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCounterpartiesListResponse execute(ListPageParametersObject page, ExecuteFilterParameter5 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get Counterparties List + * Get Counterparties List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitCounterpartiesListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter5 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Counterparties List (asynchronously) + * Get Counterparties List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter5 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListCustomersApi.java b/src/main/java/org/openapitools/client/api/GetListCustomersApi.java new file mode 100644 index 00000000..2138902d --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListCustomersApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter3; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitCustomersListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListCustomersApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListCustomersApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListCustomersApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter3 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/customers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter3 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get Customers List + * Get Customers List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitCustomersListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCustomersListResponse execute(ListPageParametersObject page, ExecuteFilterParameter3 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get Customers List + * Get Customers List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitCustomersListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter3 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Customers List (asynchronously) + * Get Customers List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter3 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListDisputesApi.java b/src/main/java/org/openapitools/client/api/GetListDisputesApi.java new file mode 100644 index 00000000..f13d8d91 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListDisputesApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Dispute; +import org.openapitools.client.model.ExecuteFilterParameter17; +import org.openapitools.client.model.ListPageParametersObject; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListDisputesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListDisputesApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListDisputesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter17 filter, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/disputes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter17 filter, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, _callback); + + } + + /** + * Get List Disputes + * Get List Disputes from API + * @param page (optional) + * @param filter (optional) + * @return List<Dispute> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public List execute(ListPageParametersObject page, ExecuteFilterParameter17 filter) throws ApiException { + ApiResponse> localVarResp = executeWithHttpInfo(page, filter); + return localVarResp.getData(); + } + + /** + * Get List Disputes + * Get List Disputes from API + * @param page (optional) + * @param filter (optional) + * @return ApiResponse<List<Dispute>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse> executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter17 filter) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Disputes (asynchronously) + * Get List Disputes from API + * @param page (optional) + * @param filter (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter17 filter, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListEventsApi.java b/src/main/java/org/openapitools/client/api/GetListEventsApi.java new file mode 100644 index 00000000..fc679d63 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListEventsApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter12; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitEventListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListEventsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListEventsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListEventsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter12 filter, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/events"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter12 filter, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, _callback); + + } + + /** + * Get Events List + * Get Events List from API + * @param page (optional) + * @param filter (optional) + * @return UnitEventListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitEventListResponse execute(ListPageParametersObject page, ExecuteFilterParameter12 filter) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter); + return localVarResp.getData(); + } + + /** + * Get Events List + * Get Events List from API + * @param page (optional) + * @param filter (optional) + * @return ApiResponse<UnitEventListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter12 filter) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Events List (asynchronously) + * Get Events List from API + * @param page (optional) + * @param filter (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter12 filter, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListOfCardsApi.java b/src/main/java/org/openapitools/client/api/GetListOfCardsApi.java new file mode 100644 index 00000000..ff9f3801 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListOfCardsApi.java @@ -0,0 +1,222 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter7; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitCardResponseCardsList; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListOfCardsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListOfCardsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListOfCardsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter7 filter, String include, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter7 filter, String include, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, include, sort, _callback); + + } + + /** + * Get List of Cards + * Get List of Cards from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @return UnitCardResponseCardsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponseCardsList execute(ListPageParametersObject page, ExecuteFilterParameter7 filter, String include, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, include, sort); + return localVarResp.getData(); + } + + /** + * Get List of Cards + * Get List of Cards from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @return ApiResponse<UnitCardResponseCardsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter7 filter, String include, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, include, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List of Cards (asynchronously) + * Get List of Cards from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter7 filter, String include, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, include, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListOfDocumentsApi.java b/src/main/java/org/openapitools/client/api/GetListOfDocumentsApi.java new file mode 100644 index 00000000..52f443a0 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListOfDocumentsApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Execute200Response; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListOfDocumentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListOfDocumentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListOfDocumentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to get documents for (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + return executeCall(applicationId, _callback); + + } + + /** + * Get List of Documents + * Get List of Documents via API + * @param applicationId ID of the application to get documents for (required) + * @return Execute200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public Execute200Response execute(String applicationId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId); + return localVarResp.getData(); + } + + /** + * Get List of Documents + * Get List of Documents via API + * @param applicationId ID of the application to get documents for (required) + * @return ApiResponse<Execute200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List of Documents (asynchronously) + * Get List of Documents via API + * @param applicationId ID of the application to get documents for (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListOrgApiTokensApi.java b/src/main/java/org/openapitools/client/api/GetListOrgApiTokensApi.java new file mode 100644 index 00000000..13d1173f --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListOrgApiTokensApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitOrgApiTokensListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListOrgApiTokensApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListOrgApiTokensApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListOrgApiTokensApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param userId ID of the user to revoke token (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String userId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{userId}/api-tokens" + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String userId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling execute(Async)"); + } + + return executeCall(userId, _callback); + + } + + /** + * Get List Org API Tokens + * Get List Org API Tokens from API + * @param userId ID of the user to revoke token (required) + * @return UnitOrgApiTokensListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitOrgApiTokensListResponse execute(String userId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(userId); + return localVarResp.getData(); + } + + /** + * Get List Org API Tokens + * Get List Org API Tokens from API + * @param userId ID of the user to revoke token (required) + * @return ApiResponse<UnitOrgApiTokensListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String userId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(userId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Org API Tokens (asynchronously) + * Get List Org API Tokens from API + * @param userId ID of the user to revoke token (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String userId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(userId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListPaymentsApi.java b/src/main/java/org/openapitools/client/api/GetListPaymentsApi.java new file mode 100644 index 00000000..b4e5d6bb --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListPaymentsApi.java @@ -0,0 +1,222 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter4; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitPaymentsListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListPaymentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListPaymentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListPaymentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter4 filter, String include, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter4 filter, String include, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, include, sort, _callback); + + } + + /** + * Get List Payments + * Get List Payments from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @return UnitPaymentsListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitPaymentsListResponse execute(ListPageParametersObject page, ExecuteFilterParameter4 filter, String include, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, include, sort); + return localVarResp.getData(); + } + + /** + * Get List Payments + * Get List Payments from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @return ApiResponse<UnitPaymentsListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter4 filter, String include, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, include, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Payments (asynchronously) + * Get List Payments from API + * @param page (optional) + * @param filter (optional) + * @param include (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter4 filter, String include, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, include, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListRecurringPaymentsApi.java b/src/main/java/org/openapitools/client/api/GetListRecurringPaymentsApi.java new file mode 100644 index 00000000..378345a1 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListRecurringPaymentsApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter6; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitRecurringPaymentListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListRecurringPaymentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListRecurringPaymentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListRecurringPaymentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter6 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/recurring-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter6 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get Recurring Payments List + * Get Recurring Payments List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitRecurringPaymentListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRecurringPaymentListResponse execute(ListPageParametersObject page, ExecuteFilterParameter6 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get Recurring Payments List + * Get Recurring Payments List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitRecurringPaymentListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter6 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Recurring Payments List (asynchronously) + * Get Recurring Payments List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter6 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListRepaymentsApi.java b/src/main/java/org/openapitools/client/api/GetListRepaymentsApi.java new file mode 100644 index 00000000..77c13c1c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListRepaymentsApi.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter18; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitRepaymentsListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListRepaymentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListRepaymentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListRepaymentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter18 filter, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/repayments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter18 filter, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, _callback); + + } + + /** + * Get List Repayments + * Get List Repayments from API + * @param page (optional) + * @param filter (optional) + * @return UnitRepaymentsListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public UnitRepaymentsListResponse execute(ListPageParametersObject page, ExecuteFilterParameter18 filter) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter); + return localVarResp.getData(); + } + + /** + * Get List Repayments + * Get List Repayments from API + * @param page (optional) + * @param filter (optional) + * @return ApiResponse<UnitRepaymentsListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter18 filter) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Repayments (asynchronously) + * Get List Repayments from API + * @param page (optional) + * @param filter (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
401 -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter18 filter, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListRewardsApi.java b/src/main/java/org/openapitools/client/api/GetListRewardsApi.java new file mode 100644 index 00000000..ea2fbf2f --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListRewardsApi.java @@ -0,0 +1,222 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter11; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitRewardsListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListRewardsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListRewardsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListRewardsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter11 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/rewards"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter11 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, include, _callback); + + } + + /** + * Get Rewards List + * Get Rewards List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return UnitRewardsListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRewardsListResponse execute(ListPageParametersObject page, ExecuteFilterParameter11 filter, String sort, String include) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort, include); + return localVarResp.getData(); + } + + /** + * Get Rewards List + * Get Rewards List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return ApiResponse<UnitRewardsListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter11 filter, String sort, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Rewards List (asynchronously) + * Get Rewards List from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter11 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListStatementsApi.java b/src/main/java/org/openapitools/client/api/GetListStatementsApi.java new file mode 100644 index 00000000..fde5c332 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListStatementsApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter10; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitStatementsResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListStatementsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListStatementsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListStatementsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter10 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/statements"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter10 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get List Statements + * Get List Statements from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitStatementsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitStatementsResponse execute(ListPageParametersObject page, ExecuteFilterParameter10 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get List Statements + * Get List Statements from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitStatementsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter10 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Statements (asynchronously) + * Get List Statements from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter10 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListTransactionsApi.java b/src/main/java/org/openapitools/client/api/GetListTransactionsApi.java new file mode 100644 index 00000000..3ed6df92 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListTransactionsApi.java @@ -0,0 +1,222 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter16; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitTransactionsListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListTransactionsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListTransactionsApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListTransactionsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter16 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/transactions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter16 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, include, _callback); + + } + + /** + * Get List Transactions + * Get List Transactions from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return UnitTransactionsListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitTransactionsListResponse execute(ListPageParametersObject page, ExecuteFilterParameter16 filter, String sort, String include) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort, include); + return localVarResp.getData(); + } + + /** + * Get List Transactions + * Get List Transactions from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @return ApiResponse<UnitTransactionsListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter16 filter, String sort, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Transactions (asynchronously) + * Get List Transactions from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter16 filter, String sort, String include, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, include, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetListWebhooksApi.java b/src/main/java/org/openapitools/client/api/GetListWebhooksApi.java new file mode 100644 index 00000000..6a93fa25 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetListWebhooksApi.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteFilterParameter14; +import org.openapitools.client.model.ListPageParametersObject; +import org.openapitools.client.model.UnitWebhooksListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetListWebhooksApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetListWebhooksApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetListWebhooksApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(ListPageParametersObject page, ExecuteFilterParameter14 filter, String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/webhooks"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(page.toParams()); + } + + if (filter != null) { + localVarQueryParams.addAll(filter.toParams()); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(ListPageParametersObject page, ExecuteFilterParameter14 filter, String sort, final ApiCallback _callback) throws ApiException { + return executeCall(page, filter, sort, _callback); + + } + + /** + * Get List Webhooks + * Get List Webhooks from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return UnitWebhooksListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitWebhooksListResponse execute(ListPageParametersObject page, ExecuteFilterParameter14 filter, String sort) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(page, filter, sort); + return localVarResp.getData(); + } + + /** + * Get List Webhooks + * Get List Webhooks from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @return ApiResponse<UnitWebhooksListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(ListPageParametersObject page, ExecuteFilterParameter14 filter, String sort) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get List Webhooks (asynchronously) + * Get List Webhooks from API + * @param page (optional) + * @param filter (optional) + * @param sort (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(ListPageParametersObject page, ExecuteFilterParameter14 filter, String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(page, filter, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetPaymentApi.java b/src/main/java/org/openapitools/client/api/GetPaymentApi.java new file mode 100644 index 00000000..1c3ac725 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetPaymentApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitPaymentResponseWithIncluded; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/payments/{paymentId}" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, String included, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, included, _callback); + + } + + /** + * Get Payment by Id + * Get a Payment from API + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @return UnitPaymentResponseWithIncluded + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitPaymentResponseWithIncluded execute(String paymentId, String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId, included); + return localVarResp.getData(); + } + + /** + * Get Payment by Id + * Get a Payment from API + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @return ApiResponse<UnitPaymentResponseWithIncluded> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId, String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Payment by Id (asynchronously) + * Get a Payment from API + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetReceivedPaymentApi.java b/src/main/java/org/openapitools/client/api/GetReceivedPaymentApi.java new file mode 100644 index 00000000..d8295056 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetReceivedPaymentApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitReceivedPaymentResponseWithIncluded; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetReceivedPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetReceivedPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetReceivedPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/received-payments/{paymentId}" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, String included, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, included, _callback); + + } + + /** + * Get Received Payment by Id + * Get a Received Payment from API + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @return UnitReceivedPaymentResponseWithIncluded + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitReceivedPaymentResponseWithIncluded execute(String paymentId, String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId, included); + return localVarResp.getData(); + } + + /** + * Get Received Payment by Id + * Get a Received Payment from API + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @return ApiResponse<UnitReceivedPaymentResponseWithIncluded> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId, String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Received Payment by Id (asynchronously) + * Get a Received Payment from API + * @param paymentId ID of the payment to get (required) + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetReceivedPaymentsListApi.java b/src/main/java/org/openapitools/client/api/GetReceivedPaymentsListApi.java new file mode 100644 index 00000000..8043c698 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetReceivedPaymentsListApi.java @@ -0,0 +1,196 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitReceivedPaymentListResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetReceivedPaymentsListApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetReceivedPaymentsListApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetReceivedPaymentsListApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param included (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String included, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/received-payments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (included != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("included", included)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String included, final ApiCallback _callback) throws ApiException { + return executeCall(included, _callback); + + } + + /** + * Get Received Payments List + * Get Received Payments from API + * @param included (optional) + * @return UnitReceivedPaymentListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitReceivedPaymentListResponse execute(String included) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(included); + return localVarResp.getData(); + } + + /** + * Get Received Payments List + * Get Received Payments from API + * @param included (optional) + * @return ApiResponse<UnitReceivedPaymentListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String included) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(included, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Received Payments List (asynchronously) + * Get Received Payments from API + * @param included (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String included, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(included, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetRecurringPaymentApi.java b/src/main/java/org/openapitools/client/api/GetRecurringPaymentApi.java new file mode 100644 index 00000000..b46dd4e7 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetRecurringPaymentApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitRecurringPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetRecurringPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetRecurringPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetRecurringPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/recurring-payments/{paymentId}" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + return executeCall(paymentId, _callback); + + } + + /** + * Get Recurring Payment + * Get Recurring Payment from API + * @param paymentId ID of the payment to get (required) + * @return UnitRecurringPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRecurringPaymentResponse execute(String paymentId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId); + return localVarResp.getData(); + } + + /** + * Get Recurring Payment + * Get Recurring Payment from API + * @param paymentId ID of the payment to get (required) + * @return ApiResponse<UnitRecurringPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Recurring Payment (asynchronously) + * Get Recurring Payment from API + * @param paymentId ID of the payment to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetRepaymentApi.java b/src/main/java/org/openapitools/client/api/GetRepaymentApi.java new file mode 100644 index 00000000..c9ba6cf8 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetRepaymentApi.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitRepaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetRepaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetRepaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetRepaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param repaymentId ID of the repayment to get (required) + * @param include (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String repaymentId, String include, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/repayments/{repaymentId}" + .replace("{" + "repaymentId" + "}", localVarApiClient.escapeString(repaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String repaymentId, String include, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'repaymentId' is set + if (repaymentId == null) { + throw new ApiException("Missing the required parameter 'repaymentId' when calling execute(Async)"); + } + + return executeCall(repaymentId, include, _callback); + + } + + /** + * Get Repayment by Id + * Get an Repayment from API + * @param repaymentId ID of the repayment to get (required) + * @param include (optional) + * @return UnitRepaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRepaymentResponse execute(String repaymentId, String include) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(repaymentId, include); + return localVarResp.getData(); + } + + /** + * Get Repayment by Id + * Get an Repayment from API + * @param repaymentId ID of the repayment to get (required) + * @param include (optional) + * @return ApiResponse<UnitRepaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String repaymentId, String include) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(repaymentId, include, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Repayment by Id (asynchronously) + * Get an Repayment from API + * @param repaymentId ID of the repayment to get (required) + * @param include (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String repaymentId, String include, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(repaymentId, include, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetRewardApi.java b/src/main/java/org/openapitools/client/api/GetRewardApi.java new file mode 100644 index 00000000..e3543b02 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetRewardApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitRewardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetRewardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetRewardApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetRewardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param rewardId ID of the reward to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String rewardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/rewards/{rewardId}" + .replace("{" + "rewardId" + "}", localVarApiClient.escapeString(rewardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String rewardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'rewardId' is set + if (rewardId == null) { + throw new ApiException("Missing the required parameter 'rewardId' when calling execute(Async)"); + } + + return executeCall(rewardId, _callback); + + } + + /** + * Get Reward by Id + * Get a Reward from API + * @param rewardId ID of the reward to get (required) + * @return UnitRewardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitRewardResponse execute(String rewardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(rewardId); + return localVarResp.getData(); + } + + /** + * Get Reward by Id + * Get a Reward from API + * @param rewardId ID of the reward to get (required) + * @return ApiResponse<UnitRewardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String rewardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(rewardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Reward by Id (asynchronously) + * Get a Reward from API + * @param rewardId ID of the reward to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String rewardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(rewardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetStatementHtmlApi.java b/src/main/java/org/openapitools/client/api/GetStatementHtmlApi.java new file mode 100644 index 00000000..31f182d3 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetStatementHtmlApi.java @@ -0,0 +1,197 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetStatementHtmlApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetStatementHtmlApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetStatementHtmlApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param statementId ID of the statement to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String statementId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/statements/{statementId}/html" + .replace("{" + "statementId" + "}", localVarApiClient.escapeString(statementId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/html" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String statementId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'statementId' is set + if (statementId == null) { + throw new ApiException("Missing the required parameter 'statementId' when calling execute(Async)"); + } + + return executeCall(statementId, _callback); + + } + + /** + * Get HTML Statement by Id + * Get a HTML Statement from API + * @param statementId ID of the statement to get (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public String execute(String statementId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(statementId); + return localVarResp.getData(); + } + + /** + * Get HTML Statement by Id + * Get a HTML Statement from API + * @param statementId ID of the statement to get (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String statementId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(statementId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get HTML Statement by Id (asynchronously) + * Get a HTML Statement from API + * @param statementId ID of the statement to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String statementId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(statementId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetStatementPdfApi.java b/src/main/java/org/openapitools/client/api/GetStatementPdfApi.java new file mode 100644 index 00000000..9dbb62db --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetStatementPdfApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetStatementPdfApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetStatementPdfApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetStatementPdfApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param statementId ID of the statement to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String statementId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/statements/{statementId}/pdf" + .replace("{" + "statementId" + "}", localVarApiClient.escapeString(statementId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/pdf" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String statementId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'statementId' is set + if (statementId == null) { + throw new ApiException("Missing the required parameter 'statementId' when calling execute(Async)"); + } + + return executeCall(statementId, _callback); + + } + + /** + * Get PDF Statement by Id + * Get a PDF Statement from API + * @param statementId ID of the statement to get (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public File execute(String statementId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(statementId); + return localVarResp.getData(); + } + + /** + * Get PDF Statement by Id + * Get a PDF Statement from API + * @param statementId ID of the statement to get (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String statementId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(statementId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get PDF Statement by Id (asynchronously) + * Get a PDF Statement from API + * @param statementId ID of the statement to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String statementId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(statementId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetTransactionApi.java b/src/main/java/org/openapitools/client/api/GetTransactionApi.java new file mode 100644 index 00000000..543d81d9 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetTransactionApi.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitTransactionResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetTransactionApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetTransactionApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetTransactionApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to get transaction from (required) + * @param transactionId ID of the transaction (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String accountId, String transactionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/transactions/{transactionId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "transactionId" + "}", localVarApiClient.escapeString(transactionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, String transactionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + // verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new ApiException("Missing the required parameter 'transactionId' when calling execute(Async)"); + } + + return executeCall(accountId, transactionId, _callback); + + } + + /** + * Get Transaction by Id + * Get a Transaction from API + * @param accountId ID of the account to get transaction from (required) + * @param transactionId ID of the transaction (required) + * @return UnitTransactionResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitTransactionResponse execute(String accountId, String transactionId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId, transactionId); + return localVarResp.getData(); + } + + /** + * Get Transaction by Id + * Get a Transaction from API + * @param accountId ID of the account to get transaction from (required) + * @param transactionId ID of the transaction (required) + * @return ApiResponse<UnitTransactionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String accountId, String transactionId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, transactionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Transaction by Id (asynchronously) + * Get a Transaction from API + * @param accountId ID of the account to get transaction from (required) + * @param transactionId ID of the transaction (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String accountId, String transactionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, transactionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/GetWebhookApi.java b/src/main/java/org/openapitools/client/api/GetWebhookApi.java new file mode 100644 index 00000000..93c86650 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/GetWebhookApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitWebhookResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetWebhookApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public GetWebhookApi() { + this(Configuration.getDefaultApiClient()); + } + + public GetWebhookApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param webhookId ID of the webhook to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String webhookId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/webhooks/{webhookId}" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String webhookId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException("Missing the required parameter 'webhookId' when calling execute(Async)"); + } + + return executeCall(webhookId, _callback); + + } + + /** + * Get Webhook Id + * Get a Webhook from API + * @param webhookId ID of the webhook to get (required) + * @return UnitWebhookResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitWebhookResponse execute(String webhookId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(webhookId); + return localVarResp.getData(); + } + + /** + * Get Webhook Id + * Get a Webhook from API + * @param webhookId ID of the webhook to get (required) + * @return ApiResponse<UnitWebhookResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String webhookId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Webhook Id (asynchronously) + * Get a Webhook from API + * @param webhookId ID of the webhook to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String webhookId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ReopenAnAccountApi.java b/src/main/java/org/openapitools/client/api/ReopenAnAccountApi.java new file mode 100644 index 00000000..dd1a1898 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ReopenAnAccountApi.java @@ -0,0 +1,202 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReopenAnAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReopenAnAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReopenAnAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to close (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/reopen" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Reopen an Account by Id + * Reopen an Account via API + * @param accountId ID of the account to close (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Reopen an Account by Id + * Reopen an Account via API + * @param accountId ID of the account to close (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Reopen an Account by Id (asynchronously) + * Reopen an Account via API + * @param accountId ID of the account to close (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ReportCardAsLostApi.java b/src/main/java/org/openapitools/client/api/ReportCardAsLostApi.java new file mode 100644 index 00000000..7e980f50 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ReportCardAsLostApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReportCardAsLostApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReportCardAsLostApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReportCardAsLostApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/report-lost" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Report lost as stolen + * Report lost as stolen via API + * @param cardId ID of the card (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Report lost as stolen + * Report lost as stolen via API + * @param cardId ID of the card (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Report lost as stolen (asynchronously) + * Report lost as stolen via API + * @param cardId ID of the card (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ReportCardAsStolenApi.java b/src/main/java/org/openapitools/client/api/ReportCardAsStolenApi.java new file mode 100644 index 00000000..7216f8c7 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ReportCardAsStolenApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReportCardAsStolenApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReportCardAsStolenApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReportCardAsStolenApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/report-stolen" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Report card as stolen + * Report card as stolen via API + * @param cardId ID of the card (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Report card as stolen + * Report card as stolen via API + * @param cardId ID of the card (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Report card as stolen (asynchronously) + * Report card as stolen via API + * @param cardId ID of the card (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ReturnCheckPaymentApi.java b/src/main/java/org/openapitools/client/api/ReturnCheckPaymentApi.java new file mode 100644 index 00000000..04179885 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/ReturnCheckPaymentApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest21; +import org.openapitools.client.model.UnitCheckPaymentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReturnCheckPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReturnCheckPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReturnCheckPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkPaymentId ID of the check payment to return (required) + * @param executeRequest21 Return Check Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkPaymentId, ExecuteRequest21 executeRequest21, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest21; + + // create path and map variables + String localVarPath = "/check-payments/{checkPaymentId}/return" + .replace("{" + "checkPaymentId" + "}", localVarApiClient.escapeString(checkPaymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkPaymentId, ExecuteRequest21 executeRequest21, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkPaymentId' is set + if (checkPaymentId == null) { + throw new ApiException("Missing the required parameter 'checkPaymentId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest21' is set + if (executeRequest21 == null) { + throw new ApiException("Missing the required parameter 'executeRequest21' when calling execute(Async)"); + } + + return executeCall(checkPaymentId, executeRequest21, _callback); + + } + + /** + * Return Check Payment by Id + * Return a Check Payment via API + * @param checkPaymentId ID of the check payment to return (required) + * @param executeRequest21 Return Check Payment Request (required) + * @return UnitCheckPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckPaymentResponse execute(String checkPaymentId, ExecuteRequest21 executeRequest21) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkPaymentId, executeRequest21); + return localVarResp.getData(); + } + + /** + * Return Check Payment by Id + * Return a Check Payment via API + * @param checkPaymentId ID of the check payment to return (required) + * @param executeRequest21 Return Check Payment Request (required) + * @return ApiResponse<UnitCheckPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkPaymentId, ExecuteRequest21 executeRequest21) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, executeRequest21, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Return Check Payment by Id (asynchronously) + * Return a Check Payment via API + * @param checkPaymentId ID of the check payment to return (required) + * @param executeRequest21 Return Check Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkPaymentId, ExecuteRequest21 executeRequest21, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkPaymentId, executeRequest21, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/RevokeOrgApiTokenApi.java b/src/main/java/org/openapitools/client/api/RevokeOrgApiTokenApi.java new file mode 100644 index 00000000..57978044 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/RevokeOrgApiTokenApi.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitApiTokenResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class RevokeOrgApiTokenApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public RevokeOrgApiTokenApi() { + this(Configuration.getDefaultApiClient()); + } + + public RevokeOrgApiTokenApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param userId ID of the user to revoke token (required) + * @param tokenId ID of the token to revoke (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String userId, String tokenId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{userId}/api-tokens/{tokenId}" + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())) + .replace("{" + "tokenId" + "}", localVarApiClient.escapeString(tokenId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String userId, String tokenId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling execute(Async)"); + } + + // verify the required parameter 'tokenId' is set + if (tokenId == null) { + throw new ApiException("Missing the required parameter 'tokenId' when calling execute(Async)"); + } + + return executeCall(userId, tokenId, _callback); + + } + + /** + * Get Reward by Id + * Get a Reward from API + * @param userId ID of the user to revoke token (required) + * @param tokenId ID of the token to revoke (required) + * @return UnitApiTokenResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitApiTokenResponse execute(String userId, String tokenId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(userId, tokenId); + return localVarResp.getData(); + } + + /** + * Get Reward by Id + * Get a Reward from API + * @param userId ID of the user to revoke token (required) + * @param tokenId ID of the token to revoke (required) + * @return ApiResponse<UnitApiTokenResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String userId, String tokenId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(userId, tokenId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Reward by Id (asynchronously) + * Get a Reward from API + * @param userId ID of the user to revoke token (required) + * @param tokenId ID of the token to revoke (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String userId, String tokenId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(userId, tokenId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UnfreezeACardApi.java b/src/main/java/org/openapitools/client/api/UnfreezeACardApi.java new file mode 100644 index 00000000..b2d1ab6a --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UnfreezeACardApi.java @@ -0,0 +1,198 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UnfreezeACardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UnfreezeACardApi() { + this(Configuration.getDefaultApiClient()); + } + + public UnfreezeACardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to unfreeze (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/cards/{cardId}/unfreeze" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + return executeCall(cardId, _callback); + + } + + /** + * Unfreeze a Card + * Unfreeze a Card via API + * @param cardId ID of the card to unfreeze (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse execute(String cardId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId); + return localVarResp.getData(); + } + + /** + * Unfreeze a Card + * Unfreeze a Card via API + * @param cardId ID of the card to unfreeze (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Unfreeze a Card (asynchronously) + * Unfreeze a Card via API + * @param cardId ID of the card to unfreeze (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UnfreezeAccountApi.java b/src/main/java/org/openapitools/client/api/UnfreezeAccountApi.java new file mode 100644 index 00000000..d5bf17e5 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UnfreezeAccountApi.java @@ -0,0 +1,202 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UnfreezeAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UnfreezeAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public UnfreezeAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to get (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/unfreeze" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + return executeCall(accountId, _callback); + + } + + /** + * Unfreeze Account by Id + * Unfreeze an Account via API + * @param accountId ID of the account to get (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Unfreeze Account by Id + * Unfreeze an Account via API + * @param accountId ID of the account to get (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Unfreeze Account by Id (asynchronously) + * Unfreeze an Account via API + * @param accountId ID of the account to get (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateAccountApi.java b/src/main/java/org/openapitools/client/api/UpdateAccountApi.java new file mode 100644 index 00000000..a2ff90ab --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateAccountApi.java @@ -0,0 +1,213 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.PatchAccount; +import org.openapitools.client.model.UnitAccountResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateAccountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateAccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateAccountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to update (required) + * @param patchAccount Update Account Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeCall(String accountId, PatchAccount patchAccount, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = patchAccount; + + // create path and map variables + String localVarPath = "/accounts/{accountId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, PatchAccount patchAccount, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + // verify the required parameter 'patchAccount' is set + if (patchAccount == null) { + throw new ApiException("Missing the required parameter 'patchAccount' when calling execute(Async)"); + } + + return executeCall(accountId, patchAccount, _callback); + + } + + /** + * Update Account + * Update an Account via API + * @param accountId ID of the account to update (required) + * @param patchAccount Update Account Request (required) + * @return UnitAccountResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public UnitAccountResponse execute(String accountId, PatchAccount patchAccount) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId, patchAccount); + return localVarResp.getData(); + } + + /** + * Update Account + * Update an Account via API + * @param accountId ID of the account to update (required) + * @param patchAccount Update Account Request (required) + * @return ApiResponse<UnitAccountResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public ApiResponse executeWithHttpInfo(String accountId, PatchAccount patchAccount) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, patchAccount, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Account (asynchronously) + * Update an Account via API + * @param accountId ID of the account to update (required) + * @param patchAccount Update Account Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successful Response -
0 -
+ */ + public okhttp3.Call executeAsync(String accountId, PatchAccount patchAccount, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, patchAccount, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateApplicationApi.java b/src/main/java/org/openapitools/client/api/UpdateApplicationApi.java new file mode 100644 index 00000000..3a7276de --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateApplicationApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitApplicationResponseWithIncluded; +import org.openapitools.client.model.UpdateApplication; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to update (required) + * @param updateApplication Update Application Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, UpdateApplication updateApplication, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateApplication; + + // create path and map variables + String localVarPath = "/applications/{applicationId}" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, UpdateApplication updateApplication, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'updateApplication' is set + if (updateApplication == null) { + throw new ApiException("Missing the required parameter 'updateApplication' when calling execute(Async)"); + } + + return executeCall(applicationId, updateApplication, _callback); + + } + + /** + * Update Application + * Update an Application via API + * @param applicationId ID of the application to update (required) + * @param updateApplication Update Application Request (required) + * @return UnitApplicationResponseWithIncluded + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitApplicationResponseWithIncluded execute(String applicationId, UpdateApplication updateApplication) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, updateApplication); + return localVarResp.getData(); + } + + /** + * Update Application + * Update an Application via API + * @param applicationId ID of the application to update (required) + * @param updateApplication Update Application Request (required) + * @return ApiResponse<UnitApplicationResponseWithIncluded> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, UpdateApplication updateApplication) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, updateApplication, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Application (asynchronously) + * Update an Application via API + * @param applicationId ID of the application to update (required) + * @param updateApplication Update Application Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, UpdateApplication updateApplication, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, updateApplication, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateCardApi.java b/src/main/java/org/openapitools/client/api/UpdateCardApi.java new file mode 100644 index 00000000..949dbc0a --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateCardApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCardResponse; +import org.openapitools.client.model.UpdateCard; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateCardApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateCardApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateCardApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param cardId ID of the card to update (required) + * @param updateCard Update Card Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String cardId, UpdateCard updateCard, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateCard; + + // create path and map variables + String localVarPath = "/cards/{cardId}" + .replace("{" + "cardId" + "}", localVarApiClient.escapeString(cardId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String cardId, UpdateCard updateCard, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'cardId' is set + if (cardId == null) { + throw new ApiException("Missing the required parameter 'cardId' when calling execute(Async)"); + } + + // verify the required parameter 'updateCard' is set + if (updateCard == null) { + throw new ApiException("Missing the required parameter 'updateCard' when calling execute(Async)"); + } + + return executeCall(cardId, updateCard, _callback); + + } + + /** + * Update Card + * Update a Card via API + * @param cardId ID of the card to update (required) + * @param updateCard Update Card Request (required) + * @return UnitCardResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCardResponse execute(String cardId, UpdateCard updateCard) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(cardId, updateCard); + return localVarResp.getData(); + } + + /** + * Update Card + * Update a Card via API + * @param cardId ID of the card to update (required) + * @param updateCard Update Card Request (required) + * @return ApiResponse<UnitCardResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String cardId, UpdateCard updateCard) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, updateCard, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Card (asynchronously) + * Update a Card via API + * @param cardId ID of the card to update (required) + * @param updateCard Update Card Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String cardId, UpdateCard updateCard, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(cardId, updateCard, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateCheckDepositApi.java b/src/main/java/org/openapitools/client/api/UpdateCheckDepositApi.java new file mode 100644 index 00000000..744fb5c4 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateCheckDepositApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCheckDepositResponse; +import org.openapitools.client.model.UpdateCheckDeposit; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateCheckDepositApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateCheckDepositApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateCheckDepositApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param checkDepositId ID of the check deposit to update (required) + * @param updateCheckDeposit Update Check Deposit Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String checkDepositId, UpdateCheckDeposit updateCheckDeposit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateCheckDeposit; + + // create path and map variables + String localVarPath = "/check-deposits/{checkDepositId}" + .replace("{" + "checkDepositId" + "}", localVarApiClient.escapeString(checkDepositId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String checkDepositId, UpdateCheckDeposit updateCheckDeposit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkDepositId' is set + if (checkDepositId == null) { + throw new ApiException("Missing the required parameter 'checkDepositId' when calling execute(Async)"); + } + + // verify the required parameter 'updateCheckDeposit' is set + if (updateCheckDeposit == null) { + throw new ApiException("Missing the required parameter 'updateCheckDeposit' when calling execute(Async)"); + } + + return executeCall(checkDepositId, updateCheckDeposit, _callback); + + } + + /** + * Update Check Deposit + * Update a Check Deposit via API + * @param checkDepositId ID of the check deposit to update (required) + * @param updateCheckDeposit Update Check Deposit Request (required) + * @return UnitCheckDepositResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCheckDepositResponse execute(String checkDepositId, UpdateCheckDeposit updateCheckDeposit) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(checkDepositId, updateCheckDeposit); + return localVarResp.getData(); + } + + /** + * Update Check Deposit + * Update a Check Deposit via API + * @param checkDepositId ID of the check deposit to update (required) + * @param updateCheckDeposit Update Check Deposit Request (required) + * @return ApiResponse<UnitCheckDepositResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String checkDepositId, UpdateCheckDeposit updateCheckDeposit) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, updateCheckDeposit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Check Deposit (asynchronously) + * Update a Check Deposit via API + * @param checkDepositId ID of the check deposit to update (required) + * @param updateCheckDeposit Update Check Deposit Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String checkDepositId, UpdateCheckDeposit updateCheckDeposit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(checkDepositId, updateCheckDeposit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateCounterpartyApi.java b/src/main/java/org/openapitools/client/api/UpdateCounterpartyApi.java new file mode 100644 index 00000000..d352b8fa --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateCounterpartyApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCounterpartyResponse; +import org.openapitools.client.model.UpdateCounterparty; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateCounterpartyApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateCounterpartyApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateCounterpartyApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param counterpartyId ID of the counterparty to update (required) + * @param updateCounterparty Update Counterparty Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String counterpartyId, UpdateCounterparty updateCounterparty, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateCounterparty; + + // create path and map variables + String localVarPath = "/counterparties/{counterpartyId}" + .replace("{" + "counterpartyId" + "}", localVarApiClient.escapeString(counterpartyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String counterpartyId, UpdateCounterparty updateCounterparty, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'counterpartyId' is set + if (counterpartyId == null) { + throw new ApiException("Missing the required parameter 'counterpartyId' when calling execute(Async)"); + } + + // verify the required parameter 'updateCounterparty' is set + if (updateCounterparty == null) { + throw new ApiException("Missing the required parameter 'updateCounterparty' when calling execute(Async)"); + } + + return executeCall(counterpartyId, updateCounterparty, _callback); + + } + + /** + * Update Counterparty + * Update a Counterparty via API + * @param counterpartyId ID of the counterparty to update (required) + * @param updateCounterparty Update Counterparty Request (required) + * @return UnitCounterpartyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCounterpartyResponse execute(String counterpartyId, UpdateCounterparty updateCounterparty) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(counterpartyId, updateCounterparty); + return localVarResp.getData(); + } + + /** + * Update Counterparty + * Update a Counterparty via API + * @param counterpartyId ID of the counterparty to update (required) + * @param updateCounterparty Update Counterparty Request (required) + * @return ApiResponse<UnitCounterpartyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String counterpartyId, UpdateCounterparty updateCounterparty) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, updateCounterparty, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Counterparty (asynchronously) + * Update a Counterparty via API + * @param counterpartyId ID of the counterparty to update (required) + * @param updateCounterparty Update Counterparty Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String counterpartyId, UpdateCounterparty updateCounterparty, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(counterpartyId, updateCounterparty, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateCustomerApi.java b/src/main/java/org/openapitools/client/api/UpdateCustomerApi.java new file mode 100644 index 00000000..896eb45b --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateCustomerApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitCustomerResponse; +import org.openapitools.client.model.UpdateCustomer; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateCustomerApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateCustomerApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateCustomerApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param customerId ID of the customer to update (required) + * @param updateCustomer Update Customer Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String customerId, UpdateCustomer updateCustomer, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateCustomer; + + // create path and map variables + String localVarPath = "/customers/{customerId}" + .replace("{" + "customerId" + "}", localVarApiClient.escapeString(customerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String customerId, UpdateCustomer updateCustomer, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerId' is set + if (customerId == null) { + throw new ApiException("Missing the required parameter 'customerId' when calling execute(Async)"); + } + + // verify the required parameter 'updateCustomer' is set + if (updateCustomer == null) { + throw new ApiException("Missing the required parameter 'updateCustomer' when calling execute(Async)"); + } + + return executeCall(customerId, updateCustomer, _callback); + + } + + /** + * Update Customer + * Update an Customer via API + * @param customerId ID of the customer to update (required) + * @param updateCustomer Update Customer Request (required) + * @return UnitCustomerResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitCustomerResponse execute(String customerId, UpdateCustomer updateCustomer) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(customerId, updateCustomer); + return localVarResp.getData(); + } + + /** + * Update Customer + * Update an Customer via API + * @param customerId ID of the customer to update (required) + * @param updateCustomer Update Customer Request (required) + * @return ApiResponse<UnitCustomerResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String customerId, UpdateCustomer updateCustomer) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, updateCustomer, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Customer (asynchronously) + * Update an Customer via API + * @param customerId ID of the customer to update (required) + * @param updateCustomer Update Customer Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String customerId, UpdateCustomer updateCustomer, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(customerId, updateCustomer, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdatePaymentApi.java b/src/main/java/org/openapitools/client/api/UpdatePaymentApi.java new file mode 100644 index 00000000..25179db6 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdatePaymentApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitPaymentResponse; +import org.openapitools.client.model.UpdatePayment; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdatePaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdatePaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdatePaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to update (required) + * @param updatePayment Update Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, UpdatePayment updatePayment, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updatePayment; + + // create path and map variables + String localVarPath = "/payments/{paymentId}" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, UpdatePayment updatePayment, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + // verify the required parameter 'updatePayment' is set + if (updatePayment == null) { + throw new ApiException("Missing the required parameter 'updatePayment' when calling execute(Async)"); + } + + return executeCall(paymentId, updatePayment, _callback); + + } + + /** + * Update Payment + * Update an Payment via API + * @param paymentId ID of the payment to update (required) + * @param updatePayment Update Payment Request (required) + * @return UnitPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitPaymentResponse execute(String paymentId, UpdatePayment updatePayment) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId, updatePayment); + return localVarResp.getData(); + } + + /** + * Update Payment + * Update an Payment via API + * @param paymentId ID of the payment to update (required) + * @param updatePayment Update Payment Request (required) + * @return ApiResponse<UnitPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId, UpdatePayment updatePayment) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, updatePayment, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Payment (asynchronously) + * Update an Payment via API + * @param paymentId ID of the payment to update (required) + * @param updatePayment Update Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, UpdatePayment updatePayment, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, updatePayment, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateReceivedPaymentApi.java b/src/main/java/org/openapitools/client/api/UpdateReceivedPaymentApi.java new file mode 100644 index 00000000..6ee11184 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateReceivedPaymentApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitReceivedPaymentResponse; +import org.openapitools.client.model.UpdateReceivedPayment; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateReceivedPaymentApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateReceivedPaymentApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateReceivedPaymentApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param paymentId ID of the payment to update (required) + * @param updateReceivedPayment Update Received Payment Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String paymentId, UpdateReceivedPayment updateReceivedPayment, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateReceivedPayment; + + // create path and map variables + String localVarPath = "/received-payments/{paymentId}" + .replace("{" + "paymentId" + "}", localVarApiClient.escapeString(paymentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String paymentId, UpdateReceivedPayment updateReceivedPayment, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'paymentId' is set + if (paymentId == null) { + throw new ApiException("Missing the required parameter 'paymentId' when calling execute(Async)"); + } + + // verify the required parameter 'updateReceivedPayment' is set + if (updateReceivedPayment == null) { + throw new ApiException("Missing the required parameter 'updateReceivedPayment' when calling execute(Async)"); + } + + return executeCall(paymentId, updateReceivedPayment, _callback); + + } + + /** + * Update Received Payment + * Update a Received Payment via API + * @param paymentId ID of the payment to update (required) + * @param updateReceivedPayment Update Received Payment Request (required) + * @return UnitReceivedPaymentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitReceivedPaymentResponse execute(String paymentId, UpdateReceivedPayment updateReceivedPayment) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(paymentId, updateReceivedPayment); + return localVarResp.getData(); + } + + /** + * Update Received Payment + * Update a Received Payment via API + * @param paymentId ID of the payment to update (required) + * @param updateReceivedPayment Update Received Payment Request (required) + * @return ApiResponse<UnitReceivedPaymentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String paymentId, UpdateReceivedPayment updateReceivedPayment) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, updateReceivedPayment, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Received Payment (asynchronously) + * Update a Received Payment via API + * @param paymentId ID of the payment to update (required) + * @param updateReceivedPayment Update Received Payment Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String paymentId, UpdateReceivedPayment updateReceivedPayment, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(paymentId, updateReceivedPayment, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateTransactionApi.java b/src/main/java/org/openapitools/client/api/UpdateTransactionApi.java new file mode 100644 index 00000000..aaf0a45c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateTransactionApi.java @@ -0,0 +1,219 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitTransactionResponse1; +import org.openapitools.client.model.UpdateTransaction; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateTransactionApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateTransactionApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateTransactionApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param accountId ID of the account to update transaction from (required) + * @param transactionId ID of the transaction to update (required) + * @param updateTransaction Update Transaction Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String accountId, String transactionId, UpdateTransaction updateTransaction, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateTransaction; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/transactions/{transactionId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "transactionId" + "}", localVarApiClient.escapeString(transactionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String accountId, String transactionId, UpdateTransaction updateTransaction, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling execute(Async)"); + } + + // verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new ApiException("Missing the required parameter 'transactionId' when calling execute(Async)"); + } + + // verify the required parameter 'updateTransaction' is set + if (updateTransaction == null) { + throw new ApiException("Missing the required parameter 'updateTransaction' when calling execute(Async)"); + } + + return executeCall(accountId, transactionId, updateTransaction, _callback); + + } + + /** + * Update Transaction + * Update a Transaction via API + * @param accountId ID of the account to update transaction from (required) + * @param transactionId ID of the transaction to update (required) + * @param updateTransaction Update Transaction Request (required) + * @return UnitTransactionResponse1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitTransactionResponse1 execute(String accountId, String transactionId, UpdateTransaction updateTransaction) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(accountId, transactionId, updateTransaction); + return localVarResp.getData(); + } + + /** + * Update Transaction + * Update a Transaction via API + * @param accountId ID of the account to update transaction from (required) + * @param transactionId ID of the transaction to update (required) + * @param updateTransaction Update Transaction Request (required) + * @return ApiResponse<UnitTransactionResponse1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String accountId, String transactionId, UpdateTransaction updateTransaction) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, transactionId, updateTransaction, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Transaction (asynchronously) + * Update a Transaction via API + * @param accountId ID of the account to update transaction from (required) + * @param transactionId ID of the transaction to update (required) + * @param updateTransaction Update Transaction Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String accountId, String transactionId, UpdateTransaction updateTransaction, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(accountId, transactionId, updateTransaction, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UpdateWebhookApi.java b/src/main/java/org/openapitools/client/api/UpdateWebhookApi.java new file mode 100644 index 00000000..b7860ae8 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UpdateWebhookApi.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitWebhookResponse; +import org.openapitools.client.model.UpdateUnitRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateWebhookApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UpdateWebhookApi() { + this(Configuration.getDefaultApiClient()); + } + + public UpdateWebhookApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param webhookId ID of the Webhook to update (required) + * @param updateUnitRequest Update Webhook Request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeCall(String webhookId, UpdateUnitRequest updateUnitRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateUnitRequest; + + // create path and map variables + String localVarPath = "/webhooks/{webhookId}" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.api+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String webhookId, UpdateUnitRequest updateUnitRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException("Missing the required parameter 'webhookId' when calling execute(Async)"); + } + + // verify the required parameter 'updateUnitRequest' is set + if (updateUnitRequest == null) { + throw new ApiException("Missing the required parameter 'updateUnitRequest' when calling execute(Async)"); + } + + return executeCall(webhookId, updateUnitRequest, _callback); + + } + + /** + * Update Webhook + * Update a Webhook via API + * @param webhookId ID of the Webhook to update (required) + * @param updateUnitRequest Update Webhook Request (required) + * @return UnitWebhookResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public UnitWebhookResponse execute(String webhookId, UpdateUnitRequest updateUnitRequest) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(webhookId, updateUnitRequest); + return localVarResp.getData(); + } + + /** + * Update Webhook + * Update a Webhook via API + * @param webhookId ID of the Webhook to update (required) + * @param updateUnitRequest Update Webhook Request (required) + * @return ApiResponse<UnitWebhookResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String webhookId, UpdateUnitRequest updateUnitRequest) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, updateUnitRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Webhook (asynchronously) + * Update a Webhook via API + * @param webhookId ID of the Webhook to update (required) + * @param updateUnitRequest Update Webhook Request (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
201 Successful Response -
+ */ + public okhttp3.Call executeAsync(String webhookId, UpdateUnitRequest updateUnitRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(webhookId, updateUnitRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UploadAJpegDocumentForAnApplicationApi.java b/src/main/java/org/openapitools/client/api/UploadAJpegDocumentForAnApplicationApi.java new file mode 100644 index 00000000..94aa4c3d --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UploadAJpegDocumentForAnApplicationApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadAJpegDocumentForAnApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UploadAJpegDocumentForAnApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public UploadAJpegDocumentForAnApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/?" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "image/jpeg" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, body, _callback); + + } + + /** + * Upload a JPEG document + * Upload a JPEG file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, Object body) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, body); + return localVarResp.getData(); + } + + /** + * Upload a JPEG document + * Upload a JPEG file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, Object body) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a JPEG document (asynchronously) + * Upload a JPEG file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UploadAJpegDocumentForAnApplicationBackSideApi.java b/src/main/java/org/openapitools/client/api/UploadAJpegDocumentForAnApplicationBackSideApi.java new file mode 100644 index 00000000..3db3e4d9 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UploadAJpegDocumentForAnApplicationBackSideApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadAJpegDocumentForAnApplicationBackSideApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UploadAJpegDocumentForAnApplicationBackSideApi() { + this(Configuration.getDefaultApiClient()); + } + + public UploadAJpegDocumentForAnApplicationBackSideApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File - Back Side (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/back/?" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "image/jpeg" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, body, _callback); + + } + + /** + * Upload a JPEG document - Back Side + * Upload a JPEG file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File - Back Side (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, Object body) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, body); + return localVarResp.getData(); + } + + /** + * Upload a JPEG document - Back Side + * Upload a JPEG file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File - Back Side (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, Object body) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a JPEG document - Back Side (asynchronously) + * Upload a JPEG file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload JPEG File - Back Side (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UploadAPdfDocumentForAnApplicationApi.java b/src/main/java/org/openapitools/client/api/UploadAPdfDocumentForAnApplicationApi.java new file mode 100644 index 00000000..26ea4f1c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UploadAPdfDocumentForAnApplicationApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadAPdfDocumentForAnApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UploadAPdfDocumentForAnApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public UploadAPdfDocumentForAnApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/pdf" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, body, _callback); + + } + + /** + * Upload a PDF document + * Upload a PDF file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, Object body) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, body); + return localVarResp.getData(); + } + + /** + * Upload a PDF document + * Upload a PDF file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, Object body) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a PDF document (asynchronously) + * Upload a PDF file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UploadAPdfDocumentForAnApplicationBackSideApi.java b/src/main/java/org/openapitools/client/api/UploadAPdfDocumentForAnApplicationBackSideApi.java new file mode 100644 index 00000000..6b3d401c --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UploadAPdfDocumentForAnApplicationBackSideApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadAPdfDocumentForAnApplicationBackSideApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UploadAPdfDocumentForAnApplicationBackSideApi() { + this(Configuration.getDefaultApiClient()); + } + + public UploadAPdfDocumentForAnApplicationBackSideApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File - Back Side (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/back" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/pdf" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, body, _callback); + + } + + /** + * Upload a PDF document - Back Side + * Upload a PDF file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File - Back Side (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, Object body) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, body); + return localVarResp.getData(); + } + + /** + * Upload a PDF document - Back Side + * Upload a PDF file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File - Back Side (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, Object body) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a PDF document - Back Side (asynchronously) + * Upload a PDF file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PDF File - Back Side (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UploadAPngDocumentForAnApplicationApi.java b/src/main/java/org/openapitools/client/api/UploadAPngDocumentForAnApplicationApi.java new file mode 100644 index 00000000..17caea00 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UploadAPngDocumentForAnApplicationApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadAPngDocumentForAnApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UploadAPngDocumentForAnApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public UploadAPngDocumentForAnApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "image/png" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, body, _callback); + + } + + /** + * Upload a PNG document + * Upload a PNG file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, Object body) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, body); + return localVarResp.getData(); + } + + /** + * Upload a PNG document + * Upload a PNG file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, Object body) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a PNG document (asynchronously) + * Upload a PNG file via API + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/UploadAPngDocumentForAnApplicationBackSideApi.java b/src/main/java/org/openapitools/client/api/UploadAPngDocumentForAnApplicationBackSideApi.java new file mode 100644 index 00000000..952262f7 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/UploadAPngDocumentForAnApplicationBackSideApi.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadAPngDocumentForAnApplicationBackSideApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UploadAPngDocumentForAnApplicationBackSideApi() { + this(Configuration.getDefaultApiClient()); + } + + public UploadAPngDocumentForAnApplicationBackSideApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File - Back Side (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/back/" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "image/png" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, body, _callback); + + } + + /** + * Upload a PNG document - Back Side + * Upload a PNG file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File - Back Side (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, Object body) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, body); + return localVarResp.getData(); + } + + /** + * Upload a PNG document - Back Side + * Upload a PNG file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File - Back Side (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, Object body) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a PNG document - Back Side (asynchronously) + * Upload a PNG file via API - Back Side + * @param applicationId ID of the application to upload a file to (required) + * @param documentId ID of the document to upload a file for (required) + * @param body Upload PNG File - Back Side (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/VerifyADocumentForAnApplicationApi.java b/src/main/java/org/openapitools/client/api/VerifyADocumentForAnApplicationApi.java new file mode 100644 index 00000000..a2df7c71 --- /dev/null +++ b/src/main/java/org/openapitools/client/api/VerifyADocumentForAnApplicationApi.java @@ -0,0 +1,219 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.ExecuteRequest2; +import org.openapitools.client.model.UnitDocumentResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class VerifyADocumentForAnApplicationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public VerifyADocumentForAnApplicationApi() { + this(Configuration.getDefaultApiClient()); + } + + public VerifyADocumentForAnApplicationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for execute + * @param applicationId ID of the application to verify a file for (required) + * @param documentId ID of the document to verify (required) + * @param executeRequest2 Verify Document (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeCall(String applicationId, String documentId, ExecuteRequest2 executeRequest2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = executeRequest2; + + // create path and map variables + String localVarPath = "/applications/{applicationId}/documents/{documentId}/verify" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())) + .replace("{" + "documentId" + "}", localVarApiClient.escapeString(documentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.api+json; charset=utf-8" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call executeValidateBeforeCall(String applicationId, String documentId, ExecuteRequest2 executeRequest2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling execute(Async)"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new ApiException("Missing the required parameter 'documentId' when calling execute(Async)"); + } + + // verify the required parameter 'executeRequest2' is set + if (executeRequest2 == null) { + throw new ApiException("Missing the required parameter 'executeRequest2' when calling execute(Async)"); + } + + return executeCall(applicationId, documentId, executeRequest2, _callback); + + } + + /** + * Verify a document + * Verify a document via API + * @param applicationId ID of the application to verify a file for (required) + * @param documentId ID of the document to verify (required) + * @param executeRequest2 Verify Document (required) + * @return UnitDocumentResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public UnitDocumentResponse execute(String applicationId, String documentId, ExecuteRequest2 executeRequest2) throws ApiException { + ApiResponse localVarResp = executeWithHttpInfo(applicationId, documentId, executeRequest2); + return localVarResp.getData(); + } + + /** + * Verify a document + * Verify a document via API + * @param applicationId ID of the application to verify a file for (required) + * @param documentId ID of the document to verify (required) + * @param executeRequest2 Verify Document (required) + * @return ApiResponse<UnitDocumentResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse executeWithHttpInfo(String applicationId, String documentId, ExecuteRequest2 executeRequest2) throws ApiException { + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, executeRequest2, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Verify a document (asynchronously) + * Verify a document via API + * @param applicationId ID of the application to verify a file for (required) + * @param documentId ID of the document to verify (required) + * @param executeRequest2 Verify Document (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call executeAsync(String applicationId, String documentId, ExecuteRequest2 executeRequest2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = executeValidateBeforeCall(applicationId, documentId, executeRequest2, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 00000000..1ea355a6 --- /dev/null +++ b/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/src/main/java/org/openapitools/client/auth/Authentication.java b/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 00000000..0222b8ad --- /dev/null +++ b/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,36 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 00000000..9f17c1c6 --- /dev/null +++ b/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,57 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 00000000..8a963ad8 --- /dev/null +++ b/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,63 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 00000000..8aa1867d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,148 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +//import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + //@JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/org/openapitools/client/model/Account.java b/src/main/java/org/openapitools/client/model/Account.java new file mode 100644 index 00000000..8aaa2a15 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Account.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Account + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Account { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public Account() { + this.type = this.getClass().getSimpleName(); + } + + public Account id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Account type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Account account = (Account) o; + return Objects.equals(this.id, account.id) && + Objects.equals(this.type, account.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Account {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Account + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Account.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Account is not found in the empty JSON string", Account.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "creditAccount": + CreditAccount.validateJsonElement(jsonElement); + break; + case "depositAccount": + DepositAccount.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Account given an JSON string + * + * @param jsonString JSON string + * @return An instance of Account + * @throws IOException if the JSON string is invalid with respect to Account + */ + public static Account fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Account.class); + } + + /** + * Convert an instance of Account to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountEndOfDay.java b/src/main/java/org/openapitools/client/model/AccountEndOfDay.java new file mode 100644 index 00000000..46bb45d8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountEndOfDay.java @@ -0,0 +1,357 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountEndOfDayAttributes; +import org.openapitools.client.model.Relationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountEndOfDay + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountEndOfDay { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNTENDOFDAY("accountEndOfDay"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AccountEndOfDayAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private Relationships relationships; + + public AccountEndOfDay() { + } + + public AccountEndOfDay type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public AccountEndOfDay id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public AccountEndOfDay attributes(AccountEndOfDayAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public AccountEndOfDayAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AccountEndOfDayAttributes attributes) { + this.attributes = attributes; + } + + + public AccountEndOfDay relationships(Relationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public Relationships getRelationships() { + return relationships; + } + + + public void setRelationships(Relationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountEndOfDay accountEndOfDay = (AccountEndOfDay) o; + return Objects.equals(this.type, accountEndOfDay.type) && + Objects.equals(this.id, accountEndOfDay.id) && + Objects.equals(this.attributes, accountEndOfDay.attributes) && + Objects.equals(this.relationships, accountEndOfDay.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountEndOfDay {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountEndOfDay + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountEndOfDay.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountEndOfDay is not found in the empty JSON string", AccountEndOfDay.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountEndOfDay.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountEndOfDay` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountEndOfDay.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + AccountEndOfDayAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + Relationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountEndOfDay.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountEndOfDay' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountEndOfDay.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountEndOfDay value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountEndOfDay read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountEndOfDay given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountEndOfDay + * @throws IOException if the JSON string is invalid with respect to AccountEndOfDay + */ + public static AccountEndOfDay fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountEndOfDay.class); + } + + /** + * Convert an instance of AccountEndOfDay to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountEndOfDayAttributes.java b/src/main/java/org/openapitools/client/model/AccountEndOfDayAttributes.java new file mode 100644 index 00000000..083aecbc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountEndOfDayAttributes.java @@ -0,0 +1,329 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountEndOfDayAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountEndOfDayAttributes { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + private LocalDate date; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_HOLD = "hold"; + @SerializedName(SERIALIZED_NAME_HOLD) + private Integer hold; + + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + private Integer available; + + public static final String SERIALIZED_NAME_OVERDRAFT_LIMIT = "overdraftLimit"; + @SerializedName(SERIALIZED_NAME_OVERDRAFT_LIMIT) + private Integer overdraftLimit; + + public AccountEndOfDayAttributes() { + } + + public AccountEndOfDayAttributes date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @javax.annotation.Nonnull + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public AccountEndOfDayAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public AccountEndOfDayAttributes hold(Integer hold) { + + this.hold = hold; + return this; + } + + /** + * Get hold + * @return hold + **/ + @javax.annotation.Nonnull + public Integer getHold() { + return hold; + } + + + public void setHold(Integer hold) { + this.hold = hold; + } + + + public AccountEndOfDayAttributes available(Integer available) { + + this.available = available; + return this; + } + + /** + * Get available + * @return available + **/ + @javax.annotation.Nonnull + public Integer getAvailable() { + return available; + } + + + public void setAvailable(Integer available) { + this.available = available; + } + + + public AccountEndOfDayAttributes overdraftLimit(Integer overdraftLimit) { + + this.overdraftLimit = overdraftLimit; + return this; + } + + /** + * Get overdraftLimit + * @return overdraftLimit + **/ + @javax.annotation.Nullable + public Integer getOverdraftLimit() { + return overdraftLimit; + } + + + public void setOverdraftLimit(Integer overdraftLimit) { + this.overdraftLimit = overdraftLimit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountEndOfDayAttributes accountEndOfDayAttributes = (AccountEndOfDayAttributes) o; + return Objects.equals(this.date, accountEndOfDayAttributes.date) && + Objects.equals(this.balance, accountEndOfDayAttributes.balance) && + Objects.equals(this.hold, accountEndOfDayAttributes.hold) && + Objects.equals(this.available, accountEndOfDayAttributes.available) && + Objects.equals(this.overdraftLimit, accountEndOfDayAttributes.overdraftLimit); + } + + @Override + public int hashCode() { + return Objects.hash(date, balance, hold, available, overdraftLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountEndOfDayAttributes {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" hold: ").append(toIndentedString(hold)).append("\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" overdraftLimit: ").append(toIndentedString(overdraftLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("balance"); + openapiFields.add("hold"); + openapiFields.add("available"); + openapiFields.add("overdraftLimit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("date"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("hold"); + openapiRequiredFields.add("available"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountEndOfDayAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountEndOfDayAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountEndOfDayAttributes is not found in the empty JSON string", AccountEndOfDayAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountEndOfDayAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountEndOfDayAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountEndOfDayAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountEndOfDayAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountEndOfDayAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountEndOfDayAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountEndOfDayAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountEndOfDayAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountEndOfDayAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountEndOfDayAttributes + * @throws IOException if the JSON string is invalid with respect to AccountEndOfDayAttributes + */ + public static AccountEndOfDayAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountEndOfDayAttributes.class); + } + + /** + * Convert an instance of AccountEndOfDayAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountLowBalanceClosureTransaction.java b/src/main/java/org/openapitools/client/model/AccountLowBalanceClosureTransaction.java new file mode 100644 index 00000000..2d8e4c45 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountLowBalanceClosureTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountLowBalanceClosureTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountLowBalanceClosureTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountLowBalanceClosureTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AccountLowBalanceClosureTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public AccountLowBalanceClosureTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public AccountLowBalanceClosureTransaction attributes(AccountLowBalanceClosureTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public AccountLowBalanceClosureTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AccountLowBalanceClosureTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public AccountLowBalanceClosureTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountLowBalanceClosureTransaction accountLowBalanceClosureTransaction = (AccountLowBalanceClosureTransaction) o; + return Objects.equals(this.attributes, accountLowBalanceClosureTransaction.attributes) && + Objects.equals(this.relationships, accountLowBalanceClosureTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountLowBalanceClosureTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountLowBalanceClosureTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountLowBalanceClosureTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountLowBalanceClosureTransaction is not found in the empty JSON string", AccountLowBalanceClosureTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountLowBalanceClosureTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountLowBalanceClosureTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountLowBalanceClosureTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountLowBalanceClosureTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountLowBalanceClosureTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountLowBalanceClosureTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountLowBalanceClosureTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountLowBalanceClosureTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountLowBalanceClosureTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountLowBalanceClosureTransaction + * @throws IOException if the JSON string is invalid with respect to AccountLowBalanceClosureTransaction + */ + public static AccountLowBalanceClosureTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountLowBalanceClosureTransaction.class); + } + + /** + * Convert an instance of AccountLowBalanceClosureTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountLowBalanceClosureTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/AccountLowBalanceClosureTransactionAllOfAttributes.java new file mode 100644 index 00000000..0b6634e0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountLowBalanceClosureTransactionAllOfAttributes.java @@ -0,0 +1,410 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountLowBalanceClosureTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountLowBalanceClosureTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public AccountLowBalanceClosureTransactionAllOfAttributes() { + } + + public AccountLowBalanceClosureTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AccountLowBalanceClosureTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public AccountLowBalanceClosureTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AccountLowBalanceClosureTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public AccountLowBalanceClosureTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public AccountLowBalanceClosureTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountLowBalanceClosureTransactionAllOfAttributes accountLowBalanceClosureTransactionAllOfAttributes = (AccountLowBalanceClosureTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, accountLowBalanceClosureTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, accountLowBalanceClosureTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, accountLowBalanceClosureTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, accountLowBalanceClosureTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, accountLowBalanceClosureTransactionAllOfAttributes.summary) && + Objects.equals(this.tags, accountLowBalanceClosureTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountLowBalanceClosureTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountLowBalanceClosureTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountLowBalanceClosureTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountLowBalanceClosureTransactionAllOfAttributes is not found in the empty JSON string", AccountLowBalanceClosureTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountLowBalanceClosureTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountLowBalanceClosureTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountLowBalanceClosureTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) && !jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountLowBalanceClosureTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountLowBalanceClosureTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountLowBalanceClosureTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountLowBalanceClosureTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountLowBalanceClosureTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountLowBalanceClosureTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountLowBalanceClosureTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AccountLowBalanceClosureTransactionAllOfAttributes + */ + public static AccountLowBalanceClosureTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountLowBalanceClosureTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of AccountLowBalanceClosureTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountRelationship.java b/src/main/java/org/openapitools/client/model/AccountRelationship.java new file mode 100644 index 00000000..f721c82e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AccountRelationshipData data; + + public AccountRelationship() { + } + + public AccountRelationship data(AccountRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AccountRelationshipData getData() { + return data; + } + + + public void setData(AccountRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRelationship accountRelationship = (AccountRelationship) o; + return Objects.equals(this.data, accountRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountRelationship is not found in the empty JSON string", AccountRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AccountRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountRelationship + * @throws IOException if the JSON string is invalid with respect to AccountRelationship + */ + public static AccountRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountRelationship.class); + } + + /** + * Convert an instance of AccountRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountRelationship1.java b/src/main/java/org/openapitools/client/model/AccountRelationship1.java new file mode 100644 index 00000000..1d0a9662 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountRelationship1.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountRelationship1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountRelationship1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AccountRelationshipData data; + + public AccountRelationship1() { + } + + public AccountRelationship1 data(AccountRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AccountRelationshipData getData() { + return data; + } + + + public void setData(AccountRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRelationship1 accountRelationship1 = (AccountRelationship1) o; + return Objects.equals(this.data, accountRelationship1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountRelationship1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountRelationship1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountRelationship1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountRelationship1 is not found in the empty JSON string", AccountRelationship1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountRelationship1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountRelationship1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountRelationship1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AccountRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountRelationship1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountRelationship1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountRelationship1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountRelationship1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountRelationship1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountRelationship1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountRelationship1 + * @throws IOException if the JSON string is invalid with respect to AccountRelationship1 + */ + public static AccountRelationship1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountRelationship1.class); + } + + /** + * Convert an instance of AccountRelationship1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountRelationship2.java b/src/main/java/org/openapitools/client/model/AccountRelationship2.java new file mode 100644 index 00000000..7f93f7e1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountRelationship2.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationship2Data; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountRelationship2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountRelationship2 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AccountRelationship2Data data; + + public AccountRelationship2() { + } + + public AccountRelationship2 data(AccountRelationship2Data data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AccountRelationship2Data getData() { + return data; + } + + + public void setData(AccountRelationship2Data data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRelationship2 accountRelationship2 = (AccountRelationship2) o; + return Objects.equals(this.data, accountRelationship2.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountRelationship2 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountRelationship2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountRelationship2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountRelationship2 is not found in the empty JSON string", AccountRelationship2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountRelationship2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountRelationship2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountRelationship2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AccountRelationship2Data.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountRelationship2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountRelationship2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountRelationship2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountRelationship2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountRelationship2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountRelationship2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountRelationship2 + * @throws IOException if the JSON string is invalid with respect to AccountRelationship2 + */ + public static AccountRelationship2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountRelationship2.class); + } + + /** + * Convert an instance of AccountRelationship2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountRelationship2Data.java b/src/main/java/org/openapitools/client/model/AccountRelationship2Data.java new file mode 100644 index 00000000..ffa21475 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountRelationship2Data.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountRelationship2Data + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountRelationship2Data { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DEPOSITACCOUNT("depositAccount"), + + GLACCOUNT("glAccount"), + + ACCOUNT("account"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AccountRelationship2Data() { + } + + public AccountRelationship2Data type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public AccountRelationship2Data id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRelationship2Data accountRelationship2Data = (AccountRelationship2Data) o; + return Objects.equals(this.type, accountRelationship2Data.type) && + Objects.equals(this.id, accountRelationship2Data.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountRelationship2Data {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountRelationship2Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountRelationship2Data.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountRelationship2Data is not found in the empty JSON string", AccountRelationship2Data.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountRelationship2Data.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountRelationship2Data` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountRelationship2Data.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountRelationship2Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountRelationship2Data' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountRelationship2Data.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountRelationship2Data value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountRelationship2Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountRelationship2Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountRelationship2Data + * @throws IOException if the JSON string is invalid with respect to AccountRelationship2Data + */ + public static AccountRelationship2Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountRelationship2Data.class); + } + + /** + * Convert an instance of AccountRelationship2Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AccountRelationshipData.java b/src/main/java/org/openapitools/client/model/AccountRelationshipData.java new file mode 100644 index 00000000..53bcc3df --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AccountRelationshipData.java @@ -0,0 +1,299 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AccountRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AccountRelationshipData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"), + + DEPOSITACCOUNT("depositAccount"), + + CREDITACCOUNT("creditAccount"), + + BATCHACCOUNT("batchAccount"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AccountRelationshipData() { + } + + public AccountRelationshipData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public AccountRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRelationshipData accountRelationshipData = (AccountRelationshipData) o; + return Objects.equals(this.type, accountRelationshipData.type) && + Objects.equals(this.id, accountRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountRelationshipData is not found in the empty JSON string", AccountRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AccountRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccountRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AccountRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountRelationshipData + * @throws IOException if the JSON string is invalid with respect to AccountRelationshipData + */ + public static AccountRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountRelationshipData.class); + } + + /** + * Convert an instance of AccountRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchPayment.java b/src/main/java/org/openapitools/client/model/AchPayment.java new file mode 100644 index 00000000..eab74f7e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchPayment.java @@ -0,0 +1,251 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchPaymentAllOfAttributes; +import org.openapitools.client.model.Payment; +import org.openapitools.client.model.PaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchPayment extends Payment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AchPaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private PaymentRelationships relationships; + + public AchPayment() { + this.type = this.getClass().getSimpleName(); + } + + public AchPayment attributes(AchPaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public AchPaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AchPaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public AchPayment relationships(PaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public PaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(PaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchPayment achPayment = (AchPayment) o; + return Objects.equals(this.attributes, achPayment.attributes) && + Objects.equals(this.relationships, achPayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchPayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchPayment is not found in the empty JSON string", AchPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchPayment + * @throws IOException if the JSON string is invalid with respect to AchPayment + */ + public static AchPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchPayment.class); + } + + /** + * Convert an instance of AchPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchPaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/AchPaymentAllOfAttributes.java new file mode 100644 index 00000000..6f054ee7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchPaymentAllOfAttributes.java @@ -0,0 +1,847 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchPaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchPaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_SETTLEMENT_DATE = "settlementDate"; + @SerializedName(SERIALIZED_NAME_SETTLEMENT_DATE) + private LocalDate settlementDate; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_EXPECTED_COMPLETION_DATE = "expectedCompletionDate"; + @SerializedName(SERIALIZED_NAME_EXPECTED_COMPLETION_DATE) + private LocalDate expectedCompletionDate; + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private String secCode; + + public static final String SERIALIZED_NAME_TRACE_NUMBER = "traceNumber"; + @SerializedName(SERIALIZED_NAME_TRACE_NUMBER) + private String traceNumber; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay; + + public static final String SERIALIZED_NAME_COUNTERPARTY_VERIFICATION_METHOD = "counterpartyVerificationMethod"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_VERIFICATION_METHOD) + private String counterpartyVerificationMethod; + + public static final String SERIALIZED_NAME_CLEARING_DAYS_OVERRIDE = "clearingDaysOverride"; + @SerializedName(SERIALIZED_NAME_CLEARING_DAYS_OVERRIDE) + private Integer clearingDaysOverride; + + public AchPaymentAllOfAttributes() { + } + + public AchPaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AchPaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AchPaymentAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public AchPaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public AchPaymentAllOfAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public AchPaymentAllOfAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public AchPaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public AchPaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public AchPaymentAllOfAttributes settlementDate(LocalDate settlementDate) { + + this.settlementDate = settlementDate; + return this; + } + + /** + * Get settlementDate + * @return settlementDate + **/ + @javax.annotation.Nullable + public LocalDate getSettlementDate() { + return settlementDate; + } + + + public void setSettlementDate(LocalDate settlementDate) { + this.settlementDate = settlementDate; + } + + + public AchPaymentAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public AchPaymentAllOfAttributes expectedCompletionDate(LocalDate expectedCompletionDate) { + + this.expectedCompletionDate = expectedCompletionDate; + return this; + } + + /** + * Get expectedCompletionDate + * @return expectedCompletionDate + **/ + @javax.annotation.Nullable + public LocalDate getExpectedCompletionDate() { + return expectedCompletionDate; + } + + + public void setExpectedCompletionDate(LocalDate expectedCompletionDate) { + this.expectedCompletionDate = expectedCompletionDate; + } + + + public AchPaymentAllOfAttributes secCode(String secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public String getSecCode() { + return secCode; + } + + + public void setSecCode(String secCode) { + this.secCode = secCode; + } + + + public AchPaymentAllOfAttributes traceNumber(String traceNumber) { + + this.traceNumber = traceNumber; + return this; + } + + /** + * Get traceNumber + * @return traceNumber + **/ + @javax.annotation.Nullable + public String getTraceNumber() { + return traceNumber; + } + + + public void setTraceNumber(String traceNumber) { + this.traceNumber = traceNumber; + } + + + public AchPaymentAllOfAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + public AchPaymentAllOfAttributes counterpartyVerificationMethod(String counterpartyVerificationMethod) { + + this.counterpartyVerificationMethod = counterpartyVerificationMethod; + return this; + } + + /** + * Get counterpartyVerificationMethod + * @return counterpartyVerificationMethod + **/ + @javax.annotation.Nullable + public String getCounterpartyVerificationMethod() { + return counterpartyVerificationMethod; + } + + + public void setCounterpartyVerificationMethod(String counterpartyVerificationMethod) { + this.counterpartyVerificationMethod = counterpartyVerificationMethod; + } + + + public AchPaymentAllOfAttributes clearingDaysOverride(Integer clearingDaysOverride) { + + this.clearingDaysOverride = clearingDaysOverride; + return this; + } + + /** + * Get clearingDaysOverride + * @return clearingDaysOverride + **/ + @javax.annotation.Nullable + public Integer getClearingDaysOverride() { + return clearingDaysOverride; + } + + + public void setClearingDaysOverride(Integer clearingDaysOverride) { + this.clearingDaysOverride = clearingDaysOverride; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AchPaymentAllOfAttributes instance itself + */ + public AchPaymentAllOfAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchPaymentAllOfAttributes achPaymentAllOfAttributes = (AchPaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, achPaymentAllOfAttributes.createdAt) && + Objects.equals(this.amount, achPaymentAllOfAttributes.amount) && + Objects.equals(this.direction, achPaymentAllOfAttributes.direction) && + Objects.equals(this.description, achPaymentAllOfAttributes.description) && + Objects.equals(this.addenda, achPaymentAllOfAttributes.addenda) && + Objects.equals(this.counterparty, achPaymentAllOfAttributes.counterparty) && + Objects.equals(this.tags, achPaymentAllOfAttributes.tags) && + Objects.equals(this.status, achPaymentAllOfAttributes.status) && + Objects.equals(this.settlementDate, achPaymentAllOfAttributes.settlementDate) && + Objects.equals(this.reason, achPaymentAllOfAttributes.reason) && + Objects.equals(this.expectedCompletionDate, achPaymentAllOfAttributes.expectedCompletionDate) && + Objects.equals(this.secCode, achPaymentAllOfAttributes.secCode) && + Objects.equals(this.traceNumber, achPaymentAllOfAttributes.traceNumber) && + Objects.equals(this.sameDay, achPaymentAllOfAttributes.sameDay) && + Objects.equals(this.counterpartyVerificationMethod, achPaymentAllOfAttributes.counterpartyVerificationMethod) && + Objects.equals(this.clearingDaysOverride, achPaymentAllOfAttributes.clearingDaysOverride)&& + Objects.equals(this.additionalProperties, achPaymentAllOfAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, description, addenda, counterparty, tags, status, settlementDate, reason, expectedCompletionDate, secCode, traceNumber, sameDay, counterpartyVerificationMethod, clearingDaysOverride, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchPaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" settlementDate: ").append(toIndentedString(settlementDate)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" expectedCompletionDate: ").append(toIndentedString(expectedCompletionDate)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append(" traceNumber: ").append(toIndentedString(traceNumber)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append(" counterpartyVerificationMethod: ").append(toIndentedString(counterpartyVerificationMethod)).append("\n"); + sb.append(" clearingDaysOverride: ").append(toIndentedString(clearingDaysOverride)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("counterparty"); + openapiFields.add("tags"); + openapiFields.add("status"); + openapiFields.add("settlementDate"); + openapiFields.add("reason"); + openapiFields.add("expectedCompletionDate"); + openapiFields.add("secCode"); + openapiFields.add("traceNumber"); + openapiFields.add("sameDay"); + openapiFields.add("counterpartyVerificationMethod"); + openapiFields.add("clearingDaysOverride"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchPaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchPaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchPaymentAllOfAttributes is not found in the empty JSON string", AchPaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchPaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + if ((jsonObj.get("traceNumber") != null && !jsonObj.get("traceNumber").isJsonNull()) && !jsonObj.get("traceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `traceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceNumber").toString())); + } + if ((jsonObj.get("counterpartyVerificationMethod") != null && !jsonObj.get("counterpartyVerificationMethod").isJsonNull()) && !jsonObj.get("counterpartyVerificationMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyVerificationMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyVerificationMethod").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchPaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchPaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchPaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchPaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AchPaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AchPaymentAllOfAttributes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchPaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchPaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AchPaymentAllOfAttributes + */ + public static AchPaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchPaymentAllOfAttributes.class); + } + + /** + * Convert an instance of AchPaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepayment.java b/src/main/java/org/openapitools/client/model/AchRepayment.java new file mode 100644 index 00000000..f406352e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepayment.java @@ -0,0 +1,240 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfAttributes; +import org.openapitools.client.model.AchRepaymentAllOfRelationships; +import org.openapitools.client.model.Repayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepayment extends Repayment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AchRepaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private AchRepaymentAllOfRelationships relationships; + + public AchRepayment() { + this.type = this.getClass().getSimpleName(); + } + + public AchRepayment attributes(AchRepaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AchRepaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public AchRepayment relationships(AchRepaymentAllOfRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(AchRepaymentAllOfRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepayment achRepayment = (AchRepayment) o; + return Objects.equals(this.attributes, achRepayment.attributes) && + Objects.equals(this.relationships, achRepayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepayment is not found in the empty JSON string", AchRepayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepayment + * @throws IOException if the JSON string is invalid with respect to AchRepayment + */ + public static AchRepayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepayment.class); + } + + /** + * Convert an instance of AchRepayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfAttributes.java new file mode 100644 index 00000000..066f3bb0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfAttributes.java @@ -0,0 +1,415 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + PENDINGREVIEW("PendingReview"), + + SENT("Sent"), + + RETURNED("Returned"), + + REJECTED("Rejected"), + + CLEARING("Clearing"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public AchRepaymentAllOfAttributes() { + } + + public AchRepaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AchRepaymentAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public AchRepaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AchRepaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public AchRepaymentAllOfAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + public AchRepaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfAttributes achRepaymentAllOfAttributes = (AchRepaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, achRepaymentAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, achRepaymentAllOfAttributes.updatedAt) && + Objects.equals(this.amount, achRepaymentAllOfAttributes.amount) && + Objects.equals(this.tags, achRepaymentAllOfAttributes.tags) && + Objects.equals(this.sameDay, achRepaymentAllOfAttributes.sameDay) && + Objects.equals(this.status, achRepaymentAllOfAttributes.status); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, tags, sameDay, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("tags"); + openapiFields.add("sameDay"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfAttributes is not found in the empty JSON string", AchRepaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfAttributes + */ + public static AchRepaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfAttributes.class); + } + + /** + * Convert an instance of AchRepaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationships.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationships.java new file mode 100644 index 00000000..208d78df --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationships.java @@ -0,0 +1,342 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsAccount; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCounterparty; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCreditAccount; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCustomer; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AchRepaymentAllOfRelationshipsAccount account; + + public static final String SERIALIZED_NAME_CREDIT_ACCOUNT = "creditAccount"; + @SerializedName(SERIALIZED_NAME_CREDIT_ACCOUNT) + private AchRepaymentAllOfRelationshipsCreditAccount creditAccount; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private AchRepaymentAllOfRelationshipsCounterparty counterparty; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private AchRepaymentAllOfRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + private AchRepaymentAllOfRelationshipsPayment payment; + + public AchRepaymentAllOfRelationships() { + } + + public AchRepaymentAllOfRelationships account(AchRepaymentAllOfRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(AchRepaymentAllOfRelationshipsAccount account) { + this.account = account; + } + + + public AchRepaymentAllOfRelationships creditAccount(AchRepaymentAllOfRelationshipsCreditAccount creditAccount) { + + this.creditAccount = creditAccount; + return this; + } + + /** + * Get creditAccount + * @return creditAccount + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsCreditAccount getCreditAccount() { + return creditAccount; + } + + + public void setCreditAccount(AchRepaymentAllOfRelationshipsCreditAccount creditAccount) { + this.creditAccount = creditAccount; + } + + + public AchRepaymentAllOfRelationships counterparty(AchRepaymentAllOfRelationshipsCounterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsCounterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(AchRepaymentAllOfRelationshipsCounterparty counterparty) { + this.counterparty = counterparty; + } + + + public AchRepaymentAllOfRelationships customer(AchRepaymentAllOfRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(AchRepaymentAllOfRelationshipsCustomer customer) { + this.customer = customer; + } + + + public AchRepaymentAllOfRelationships payment(AchRepaymentAllOfRelationshipsPayment payment) { + + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsPayment getPayment() { + return payment; + } + + + public void setPayment(AchRepaymentAllOfRelationshipsPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationships achRepaymentAllOfRelationships = (AchRepaymentAllOfRelationships) o; + return Objects.equals(this.account, achRepaymentAllOfRelationships.account) && + Objects.equals(this.creditAccount, achRepaymentAllOfRelationships.creditAccount) && + Objects.equals(this.counterparty, achRepaymentAllOfRelationships.counterparty) && + Objects.equals(this.customer, achRepaymentAllOfRelationships.customer) && + Objects.equals(this.payment, achRepaymentAllOfRelationships.payment); + } + + @Override + public int hashCode() { + return Objects.hash(account, creditAccount, counterparty, customer, payment); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" creditAccount: ").append(toIndentedString(creditAccount)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("creditAccount"); + openapiFields.add("counterparty"); + openapiFields.add("customer"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationships is not found in the empty JSON string", AchRepaymentAllOfRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + AchRepaymentAllOfRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + } + // validate the optional field `creditAccount` + if (jsonObj.get("creditAccount") != null && !jsonObj.get("creditAccount").isJsonNull()) { + AchRepaymentAllOfRelationshipsCreditAccount.validateJsonElement(jsonObj.get("creditAccount")); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + AchRepaymentAllOfRelationshipsCounterparty.validateJsonElement(jsonObj.get("counterparty")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + AchRepaymentAllOfRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `payment` + if (jsonObj.get("payment") != null && !jsonObj.get("payment").isJsonNull()) { + AchRepaymentAllOfRelationshipsPayment.validateJsonElement(jsonObj.get("payment")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationships + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationships + */ + public static AchRepaymentAllOfRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationships.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsAccount.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsAccount.java new file mode 100644 index 00000000..eef04171 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AchRepaymentAllOfRelationshipsAccountData data; + + public AchRepaymentAllOfRelationshipsAccount() { + } + + public AchRepaymentAllOfRelationshipsAccount data(AchRepaymentAllOfRelationshipsAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AchRepaymentAllOfRelationshipsAccountData getData() { + return data; + } + + + public void setData(AchRepaymentAllOfRelationshipsAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsAccount achRepaymentAllOfRelationshipsAccount = (AchRepaymentAllOfRelationshipsAccount) o; + return Objects.equals(this.data, achRepaymentAllOfRelationshipsAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsAccount is not found in the empty JSON string", AchRepaymentAllOfRelationshipsAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AchRepaymentAllOfRelationshipsAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsAccount + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsAccount + */ + public static AchRepaymentAllOfRelationshipsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsAccount.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsAccountData.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsAccountData.java new file mode 100644 index 00000000..0d8116c2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsAccountData.java @@ -0,0 +1,295 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsAccountData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DEPOSITACCOUNT("depositAccount"), + + ACCOUNT("account"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AchRepaymentAllOfRelationshipsAccountData() { + } + + public AchRepaymentAllOfRelationshipsAccountData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public AchRepaymentAllOfRelationshipsAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsAccountData achRepaymentAllOfRelationshipsAccountData = (AchRepaymentAllOfRelationshipsAccountData) o; + return Objects.equals(this.type, achRepaymentAllOfRelationshipsAccountData.type) && + Objects.equals(this.id, achRepaymentAllOfRelationshipsAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsAccountData is not found in the empty JSON string", AchRepaymentAllOfRelationshipsAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsAccountData + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsAccountData + */ + public static AchRepaymentAllOfRelationshipsAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsAccountData.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCounterparty.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCounterparty.java new file mode 100644 index 00000000..c023cc13 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCounterparty.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCounterpartyData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsCounterparty { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AchRepaymentAllOfRelationshipsCounterpartyData data; + + public AchRepaymentAllOfRelationshipsCounterparty() { + } + + public AchRepaymentAllOfRelationshipsCounterparty data(AchRepaymentAllOfRelationshipsCounterpartyData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AchRepaymentAllOfRelationshipsCounterpartyData getData() { + return data; + } + + + public void setData(AchRepaymentAllOfRelationshipsCounterpartyData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsCounterparty achRepaymentAllOfRelationshipsCounterparty = (AchRepaymentAllOfRelationshipsCounterparty) o; + return Objects.equals(this.data, achRepaymentAllOfRelationshipsCounterparty.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsCounterparty {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsCounterparty is not found in the empty JSON string", AchRepaymentAllOfRelationshipsCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AchRepaymentAllOfRelationshipsCounterpartyData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsCounterparty + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsCounterparty + */ + public static AchRepaymentAllOfRelationshipsCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsCounterparty.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCounterpartyData.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCounterpartyData.java new file mode 100644 index 00000000..5a5e8258 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCounterpartyData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsCounterpartyData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsCounterpartyData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "counterparty"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AchRepaymentAllOfRelationshipsCounterpartyData() { + } + + public AchRepaymentAllOfRelationshipsCounterpartyData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AchRepaymentAllOfRelationshipsCounterpartyData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsCounterpartyData achRepaymentAllOfRelationshipsCounterpartyData = (AchRepaymentAllOfRelationshipsCounterpartyData) o; + return Objects.equals(this.type, achRepaymentAllOfRelationshipsCounterpartyData.type) && + Objects.equals(this.id, achRepaymentAllOfRelationshipsCounterpartyData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsCounterpartyData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsCounterpartyData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsCounterpartyData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsCounterpartyData is not found in the empty JSON string", AchRepaymentAllOfRelationshipsCounterpartyData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsCounterpartyData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsCounterpartyData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsCounterpartyData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsCounterpartyData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsCounterpartyData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsCounterpartyData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsCounterpartyData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsCounterpartyData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsCounterpartyData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsCounterpartyData + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsCounterpartyData + */ + public static AchRepaymentAllOfRelationshipsCounterpartyData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsCounterpartyData.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsCounterpartyData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCreditAccount.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCreditAccount.java new file mode 100644 index 00000000..ed056c8b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCreditAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCreditAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsCreditAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsCreditAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AchRepaymentAllOfRelationshipsCreditAccountData data; + + public AchRepaymentAllOfRelationshipsCreditAccount() { + } + + public AchRepaymentAllOfRelationshipsCreditAccount data(AchRepaymentAllOfRelationshipsCreditAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AchRepaymentAllOfRelationshipsCreditAccountData getData() { + return data; + } + + + public void setData(AchRepaymentAllOfRelationshipsCreditAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsCreditAccount achRepaymentAllOfRelationshipsCreditAccount = (AchRepaymentAllOfRelationshipsCreditAccount) o; + return Objects.equals(this.data, achRepaymentAllOfRelationshipsCreditAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsCreditAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsCreditAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsCreditAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsCreditAccount is not found in the empty JSON string", AchRepaymentAllOfRelationshipsCreditAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsCreditAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsCreditAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsCreditAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AchRepaymentAllOfRelationshipsCreditAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsCreditAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsCreditAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsCreditAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsCreditAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsCreditAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsCreditAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsCreditAccount + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsCreditAccount + */ + public static AchRepaymentAllOfRelationshipsCreditAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsCreditAccount.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsCreditAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCreditAccountData.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCreditAccountData.java new file mode 100644 index 00000000..94f02975 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCreditAccountData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsCreditAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsCreditAccountData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "creditAccount"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AchRepaymentAllOfRelationshipsCreditAccountData() { + } + + public AchRepaymentAllOfRelationshipsCreditAccountData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AchRepaymentAllOfRelationshipsCreditAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsCreditAccountData achRepaymentAllOfRelationshipsCreditAccountData = (AchRepaymentAllOfRelationshipsCreditAccountData) o; + return Objects.equals(this.type, achRepaymentAllOfRelationshipsCreditAccountData.type) && + Objects.equals(this.id, achRepaymentAllOfRelationshipsCreditAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsCreditAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsCreditAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsCreditAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsCreditAccountData is not found in the empty JSON string", AchRepaymentAllOfRelationshipsCreditAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsCreditAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsCreditAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsCreditAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsCreditAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsCreditAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsCreditAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsCreditAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsCreditAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsCreditAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsCreditAccountData + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsCreditAccountData + */ + public static AchRepaymentAllOfRelationshipsCreditAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsCreditAccountData.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsCreditAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCustomer.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCustomer.java new file mode 100644 index 00000000..fd1b8a77 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCustomer.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCustomerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsCustomer { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AchRepaymentAllOfRelationshipsCustomerData data; + + public AchRepaymentAllOfRelationshipsCustomer() { + } + + public AchRepaymentAllOfRelationshipsCustomer data(AchRepaymentAllOfRelationshipsCustomerData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AchRepaymentAllOfRelationshipsCustomerData getData() { + return data; + } + + + public void setData(AchRepaymentAllOfRelationshipsCustomerData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsCustomer achRepaymentAllOfRelationshipsCustomer = (AchRepaymentAllOfRelationshipsCustomer) o; + return Objects.equals(this.data, achRepaymentAllOfRelationshipsCustomer.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsCustomer {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsCustomer is not found in the empty JSON string", AchRepaymentAllOfRelationshipsCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsCustomer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AchRepaymentAllOfRelationshipsCustomerData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsCustomer + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsCustomer + */ + public static AchRepaymentAllOfRelationshipsCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsCustomer.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCustomerData.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCustomerData.java new file mode 100644 index 00000000..4efee9a8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsCustomerData.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsCustomerData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsCustomerData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSCUSTOMER("businessCustomer"), + + INDIVIDUALCUSTOMER("individualCustomer"), + + CUSTOMER("customer"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AchRepaymentAllOfRelationshipsCustomerData() { + } + + public AchRepaymentAllOfRelationshipsCustomerData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public AchRepaymentAllOfRelationshipsCustomerData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsCustomerData achRepaymentAllOfRelationshipsCustomerData = (AchRepaymentAllOfRelationshipsCustomerData) o; + return Objects.equals(this.type, achRepaymentAllOfRelationshipsCustomerData.type) && + Objects.equals(this.id, achRepaymentAllOfRelationshipsCustomerData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsCustomerData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsCustomerData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsCustomerData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsCustomerData is not found in the empty JSON string", AchRepaymentAllOfRelationshipsCustomerData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsCustomerData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsCustomerData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsCustomerData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsCustomerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsCustomerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsCustomerData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsCustomerData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsCustomerData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsCustomerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsCustomerData + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsCustomerData + */ + public static AchRepaymentAllOfRelationshipsCustomerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsCustomerData.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsCustomerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsPayment.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsPayment.java new file mode 100644 index 00000000..c70fb639 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsPayment.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsPaymentData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsPayment { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AchRepaymentAllOfRelationshipsPaymentData data; + + public AchRepaymentAllOfRelationshipsPayment() { + } + + public AchRepaymentAllOfRelationshipsPayment data(AchRepaymentAllOfRelationshipsPaymentData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AchRepaymentAllOfRelationshipsPaymentData getData() { + return data; + } + + + public void setData(AchRepaymentAllOfRelationshipsPaymentData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsPayment achRepaymentAllOfRelationshipsPayment = (AchRepaymentAllOfRelationshipsPayment) o; + return Objects.equals(this.data, achRepaymentAllOfRelationshipsPayment.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsPayment {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsPayment is not found in the empty JSON string", AchRepaymentAllOfRelationshipsPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AchRepaymentAllOfRelationshipsPaymentData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsPayment + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsPayment + */ + public static AchRepaymentAllOfRelationshipsPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsPayment.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsPaymentData.java b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsPaymentData.java new file mode 100644 index 00000000..f4df6008 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AchRepaymentAllOfRelationshipsPaymentData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AchRepaymentAllOfRelationshipsPaymentData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AchRepaymentAllOfRelationshipsPaymentData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "payment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AchRepaymentAllOfRelationshipsPaymentData() { + } + + public AchRepaymentAllOfRelationshipsPaymentData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AchRepaymentAllOfRelationshipsPaymentData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AchRepaymentAllOfRelationshipsPaymentData achRepaymentAllOfRelationshipsPaymentData = (AchRepaymentAllOfRelationshipsPaymentData) o; + return Objects.equals(this.type, achRepaymentAllOfRelationshipsPaymentData.type) && + Objects.equals(this.id, achRepaymentAllOfRelationshipsPaymentData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AchRepaymentAllOfRelationshipsPaymentData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AchRepaymentAllOfRelationshipsPaymentData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AchRepaymentAllOfRelationshipsPaymentData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AchRepaymentAllOfRelationshipsPaymentData is not found in the empty JSON string", AchRepaymentAllOfRelationshipsPaymentData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AchRepaymentAllOfRelationshipsPaymentData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AchRepaymentAllOfRelationshipsPaymentData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AchRepaymentAllOfRelationshipsPaymentData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AchRepaymentAllOfRelationshipsPaymentData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AchRepaymentAllOfRelationshipsPaymentData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AchRepaymentAllOfRelationshipsPaymentData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AchRepaymentAllOfRelationshipsPaymentData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AchRepaymentAllOfRelationshipsPaymentData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AchRepaymentAllOfRelationshipsPaymentData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AchRepaymentAllOfRelationshipsPaymentData + * @throws IOException if the JSON string is invalid with respect to AchRepaymentAllOfRelationshipsPaymentData + */ + public static AchRepaymentAllOfRelationshipsPaymentData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AchRepaymentAllOfRelationshipsPaymentData.class); + } + + /** + * Convert an instance of AchRepaymentAllOfRelationshipsPaymentData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Address.java b/src/main/java/org/openapitools/client/model/Address.java new file mode 100644 index 00000000..8482d9d5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Address.java @@ -0,0 +1,387 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Address + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Address { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + private String street; + + public static final String SERIALIZED_NAME_STREET2 = "street2"; + @SerializedName(SERIALIZED_NAME_STREET2) + private String street2; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private String state; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + private String postalCode; + + public static final String SERIALIZED_NAME_COUNTRY = "country"; + @SerializedName(SERIALIZED_NAME_COUNTRY) + private String country = "US"; + + public Address() { + } + + public Address street(String street) { + + this.street = street; + return this; + } + + /** + * Get street + * @return street + **/ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + + public void setStreet(String street) { + this.street = street; + } + + + public Address street2(String street2) { + + this.street2 = street2; + return this; + } + + /** + * Get street2 + * @return street2 + **/ + @javax.annotation.Nullable + public String getStreet2() { + return street2; + } + + + public void setStreet2(String street2) { + this.street2 = street2; + } + + + public Address city(String city) { + + this.city = city; + return this; + } + + /** + * Get city + * @return city + **/ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + + public void setCity(String city) { + this.city = city; + } + + + public Address state(String state) { + + this.state = state; + return this; + } + + /** + * Get state + * @return state + **/ + @javax.annotation.Nonnull + public String getState() { + return state; + } + + + public void setState(String state) { + this.state = state; + } + + + public Address postalCode(String postalCode) { + + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + **/ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + + public Address country(String country) { + + this.country = country; + return this; + } + + /** + * Get country + * @return country + **/ + @javax.annotation.Nonnull + public String getCountry() { + return country; + } + + + public void setCountry(String country) { + this.country = country; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Address address = (Address) o; + return Objects.equals(this.street, address.street) && + Objects.equals(this.street2, address.street2) && + Objects.equals(this.city, address.city) && + Objects.equals(this.state, address.state) && + Objects.equals(this.postalCode, address.postalCode) && + Objects.equals(this.country, address.country); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(street, street2, city, state, postalCode, country); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Address {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" street2: ").append(toIndentedString(street2)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("street2"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("postalCode"); + openapiFields.add("country"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("state"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("country"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Address + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Address.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Address is not found in the empty JSON string", Address.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Address.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Address` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Address.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("street2") != null && !jsonObj.get("street2").isJsonNull()) && !jsonObj.get("street2").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street2` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street2").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("country").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `country` to be a primitive type in the JSON string but got `%s`", jsonObj.get("country").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Address.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Address' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter
thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Address.class)); + + return (TypeAdapter) new TypeAdapter
() { + @Override + public void write(JsonWriter out, Address value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Address read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Address given an JSON string + * + * @param jsonString JSON string + * @return An instance of Address + * @throws IOException if the JSON string is invalid with respect to Address + */ + public static Address fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Address.class); + } + + /** + * Convert an instance of Address to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AdjustmentTransaction.java b/src/main/java/org/openapitools/client/model/AdjustmentTransaction.java new file mode 100644 index 00000000..9344db08 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AdjustmentTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AdjustmentTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdjustmentTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AdjustmentTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AdjustmentTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public AdjustmentTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public AdjustmentTransaction attributes(AdjustmentTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public AdjustmentTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AdjustmentTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public AdjustmentTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdjustmentTransaction adjustmentTransaction = (AdjustmentTransaction) o; + return Objects.equals(this.attributes, adjustmentTransaction.attributes) && + Objects.equals(this.relationships, adjustmentTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdjustmentTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdjustmentTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdjustmentTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdjustmentTransaction is not found in the empty JSON string", AdjustmentTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdjustmentTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdjustmentTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdjustmentTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdjustmentTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdjustmentTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdjustmentTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdjustmentTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdjustmentTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdjustmentTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdjustmentTransaction + * @throws IOException if the JSON string is invalid with respect to AdjustmentTransaction + */ + public static AdjustmentTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdjustmentTransaction.class); + } + + /** + * Convert an instance of AdjustmentTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AdjustmentTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/AdjustmentTransactionAllOfAttributes.java new file mode 100644 index 00000000..3d78ce51 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AdjustmentTransactionAllOfAttributes.java @@ -0,0 +1,442 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdjustmentTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AdjustmentTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public AdjustmentTransactionAllOfAttributes() { + } + + public AdjustmentTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AdjustmentTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public AdjustmentTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AdjustmentTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public AdjustmentTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public AdjustmentTransactionAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public AdjustmentTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdjustmentTransactionAllOfAttributes adjustmentTransactionAllOfAttributes = (AdjustmentTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, adjustmentTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, adjustmentTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, adjustmentTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, adjustmentTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, adjustmentTransactionAllOfAttributes.summary) && + Objects.equals(this.description, adjustmentTransactionAllOfAttributes.description) && + Objects.equals(this.tags, adjustmentTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, description, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdjustmentTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("description"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdjustmentTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdjustmentTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdjustmentTransactionAllOfAttributes is not found in the empty JSON string", AdjustmentTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdjustmentTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdjustmentTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdjustmentTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdjustmentTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdjustmentTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdjustmentTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdjustmentTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdjustmentTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdjustmentTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdjustmentTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AdjustmentTransactionAllOfAttributes + */ + public static AdjustmentTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdjustmentTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of AdjustmentTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AnnualIncome.java b/src/main/java/org/openapitools/client/model/AnnualIncome.java new file mode 100644 index 00000000..dda6a712 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AnnualIncome.java @@ -0,0 +1,80 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets annualIncome + */ +@JsonAdapter(AnnualIncome.Adapter.class) +public enum AnnualIncome { + + UPTO10K("UpTo10k"), + + BETWEEN10KAND25K("Between10kAnd25k"), + + BETWEEN25KAND50K("Between25kAnd50k"), + + BETWEEN50KAND100K("Between50kAnd100k"), + + BETWEEN100KAND250K("Between100kAnd250k"), + + OVER250K("Over250k"); + + private String value; + + AnnualIncome(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnnualIncome fromValue(String value) { + for (AnnualIncome b : AnnualIncome.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AnnualIncome enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnnualIncome read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnnualIncome.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApiToken.java b/src/main/java/org/openapitools/client/model/ApiToken.java new file mode 100644 index 00000000..333cb1e9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApiToken.java @@ -0,0 +1,354 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApiTokenAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApiToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiToken { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "apiToken"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ApiTokenAttributes attributes; + + public ApiToken() { + } + + public ApiToken type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ApiToken id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ApiToken attributes(ApiTokenAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ApiTokenAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ApiTokenAttributes attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ApiToken instance itself + */ + public ApiToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApiToken apiToken = (ApiToken) o; + return Objects.equals(this.type, apiToken.type) && + Objects.equals(this.id, apiToken.id) && + Objects.equals(this.attributes, apiToken.attributes)&& + Objects.equals(this.additionalProperties, apiToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApiToken {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApiToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApiToken.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApiToken is not found in the empty JSON string", ApiToken.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApiToken.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApiToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApiToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApiToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApiToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ApiToken read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiToken instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApiToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApiToken + * @throws IOException if the JSON string is invalid with respect to ApiToken + */ + public static ApiToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApiToken.class); + } + + /** + * Convert an instance of ApiToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApiTokenAttributes.java b/src/main/java/org/openapitools/client/model/ApiTokenAttributes.java new file mode 100644 index 00000000..6cf0dc37 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApiTokenAttributes.java @@ -0,0 +1,411 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApiTokenAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiTokenAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_EXPIRATION = "expiration"; + @SerializedName(SERIALIZED_NAME_EXPIRATION) + private OffsetDateTime expiration; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public static final String SERIALIZED_NAME_SOURCE_IP = "sourceIp"; + @SerializedName(SERIALIZED_NAME_SOURCE_IP) + private String sourceIp; + + public ApiTokenAttributes() { + } + + public ApiTokenAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ApiTokenAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public ApiTokenAttributes expiration(OffsetDateTime expiration) { + + this.expiration = expiration; + return this; + } + + /** + * Get expiration + * @return expiration + **/ + @javax.annotation.Nullable + public OffsetDateTime getExpiration() { + return expiration; + } + + + public void setExpiration(OffsetDateTime expiration) { + this.expiration = expiration; + } + + + public ApiTokenAttributes token(String token) { + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nullable + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + public ApiTokenAttributes sourceIp(String sourceIp) { + + this.sourceIp = sourceIp; + return this; + } + + /** + * Get sourceIp + * @return sourceIp + **/ + @javax.annotation.Nullable + public String getSourceIp() { + return sourceIp; + } + + + public void setSourceIp(String sourceIp) { + this.sourceIp = sourceIp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ApiTokenAttributes instance itself + */ + public ApiTokenAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApiTokenAttributes apiTokenAttributes = (ApiTokenAttributes) o; + return Objects.equals(this.createdAt, apiTokenAttributes.createdAt) && + Objects.equals(this.description, apiTokenAttributes.description) && + Objects.equals(this.expiration, apiTokenAttributes.expiration) && + Objects.equals(this.token, apiTokenAttributes.token) && + Objects.equals(this.sourceIp, apiTokenAttributes.sourceIp)&& + Objects.equals(this.additionalProperties, apiTokenAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, description, expiration, token, sourceIp, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApiTokenAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" expiration: ").append(toIndentedString(expiration)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" sourceIp: ").append(toIndentedString(sourceIp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("description"); + openapiFields.add("expiration"); + openapiFields.add("token"); + openapiFields.add("sourceIp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApiTokenAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApiTokenAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApiTokenAttributes is not found in the empty JSON string", ApiTokenAttributes.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApiTokenAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + if ((jsonObj.get("sourceIp") != null && !jsonObj.get("sourceIp").isJsonNull()) && !jsonObj.get("sourceIp").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceIp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceIp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApiTokenAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApiTokenAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApiTokenAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApiTokenAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ApiTokenAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiTokenAttributes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApiTokenAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApiTokenAttributes + * @throws IOException if the JSON string is invalid with respect to ApiTokenAttributes + */ + public static ApiTokenAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApiTokenAttributes.class); + } + + /** + * Convert an instance of ApiTokenAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Application.java b/src/main/java/org/openapitools/client/model/Application.java new file mode 100644 index 00000000..b54b7b19 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Application.java @@ -0,0 +1,212 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Application + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Application { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public Application() { + this.type = this.getClass().getSimpleName(); + } + + public Application id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Application type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Application application = (Application) o; + return Objects.equals(this.id, application.id) && + Objects.equals(this.type, application.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Application {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Application + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Application.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Application is not found in the empty JSON string", Application.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "businessApplication": + BusinessApplication.validateJsonElement(jsonElement); + break; + case "individualApplication": + IndividualApplication.validateJsonElement(jsonElement); + break; + case "trustApplication": + TrustApplication.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Application given an JSON string + * + * @param jsonString JSON string + * @return An instance of Application + * @throws IOException if the JSON string is invalid with respect to Application + */ + public static Application fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Application.class); + } + + /** + * Convert an instance of Application to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationForm.java b/src/main/java/org/openapitools/client/model/ApplicationForm.java new file mode 100644 index 00000000..f9838e3f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationForm.java @@ -0,0 +1,341 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApplicationFormAttributes; +import org.openapitools.client.model.ApplicationFormRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationForm + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationForm { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "applicationForm"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ApplicationFormAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private ApplicationFormRelationships relationships; + + public static final String SERIALIZED_NAME_OFFICER_IS_BENEFICIAL_OWNER = "officerIsBeneficialOwner"; + @SerializedName(SERIALIZED_NAME_OFFICER_IS_BENEFICIAL_OWNER) + private Boolean officerIsBeneficialOwner = false; + + public ApplicationForm() { + } + + public ApplicationForm type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ApplicationForm id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ApplicationForm attributes(ApplicationFormAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ApplicationFormAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ApplicationFormAttributes attributes) { + this.attributes = attributes; + } + + + public ApplicationForm relationships(ApplicationFormRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public ApplicationFormRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(ApplicationFormRelationships relationships) { + this.relationships = relationships; + } + + + public ApplicationForm officerIsBeneficialOwner(Boolean officerIsBeneficialOwner) { + + this.officerIsBeneficialOwner = officerIsBeneficialOwner; + return this; + } + + /** + * Get officerIsBeneficialOwner + * @return officerIsBeneficialOwner + **/ + @javax.annotation.Nullable + public Boolean getOfficerIsBeneficialOwner() { + return officerIsBeneficialOwner; + } + + + public void setOfficerIsBeneficialOwner(Boolean officerIsBeneficialOwner) { + this.officerIsBeneficialOwner = officerIsBeneficialOwner; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationForm applicationForm = (ApplicationForm) o; + return Objects.equals(this.type, applicationForm.type) && + Objects.equals(this.id, applicationForm.id) && + Objects.equals(this.attributes, applicationForm.attributes) && + Objects.equals(this.relationships, applicationForm.relationships) && + Objects.equals(this.officerIsBeneficialOwner, applicationForm.officerIsBeneficialOwner); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships, officerIsBeneficialOwner); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationForm {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" officerIsBeneficialOwner: ").append(toIndentedString(officerIsBeneficialOwner)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + openapiFields.add("officerIsBeneficialOwner"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationForm + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationForm.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationForm is not found in the empty JSON string", ApplicationForm.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationForm.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationForm` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApplicationForm.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + ApplicationFormAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + ApplicationFormRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationForm.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationForm' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationForm.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationForm value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationForm read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationForm given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationForm + * @throws IOException if the JSON string is invalid with respect to ApplicationForm + */ + public static ApplicationForm fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationForm.class); + } + + /** + * Convert an instance of ApplicationForm to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationFormAdditionalDisclosuresInner.java b/src/main/java/org/openapitools/client/model/ApplicationFormAdditionalDisclosuresInner.java new file mode 100644 index 00000000..5df9c4ff --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationFormAdditionalDisclosuresInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationFormAdditionalDisclosuresInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationFormAdditionalDisclosuresInner { + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public ApplicationFormAdditionalDisclosuresInner() { + } + + public ApplicationFormAdditionalDisclosuresInner title(String title) { + + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + + public void setTitle(String title) { + this.title = title; + } + + + public ApplicationFormAdditionalDisclosuresInner url(String url) { + + this.url = url; + return this; + } + + /** + * Get url + * @return url + **/ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationFormAdditionalDisclosuresInner applicationFormAdditionalDisclosuresInner = (ApplicationFormAdditionalDisclosuresInner) o; + return Objects.equals(this.title, applicationFormAdditionalDisclosuresInner.title) && + Objects.equals(this.url, applicationFormAdditionalDisclosuresInner.url); + } + + @Override + public int hashCode() { + return Objects.hash(title, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationFormAdditionalDisclosuresInner {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("title"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationFormAdditionalDisclosuresInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationFormAdditionalDisclosuresInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationFormAdditionalDisclosuresInner is not found in the empty JSON string", ApplicationFormAdditionalDisclosuresInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationFormAdditionalDisclosuresInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationFormAdditionalDisclosuresInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationFormAdditionalDisclosuresInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationFormAdditionalDisclosuresInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationFormAdditionalDisclosuresInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationFormAdditionalDisclosuresInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationFormAdditionalDisclosuresInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationFormAdditionalDisclosuresInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationFormAdditionalDisclosuresInner + * @throws IOException if the JSON string is invalid with respect to ApplicationFormAdditionalDisclosuresInner + */ + public static ApplicationFormAdditionalDisclosuresInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationFormAdditionalDisclosuresInner.class); + } + + /** + * Convert an instance of ApplicationFormAdditionalDisclosuresInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationFormAttributes.java b/src/main/java/org/openapitools/client/model/ApplicationFormAttributes.java new file mode 100644 index 00000000..4bdb7b1a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationFormAttributes.java @@ -0,0 +1,463 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Prefilled; +import org.openapitools.client.model.SettingsOverride; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationFormAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationFormAttributes { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public static final String SERIALIZED_NAME_STAGE = "stage"; + @SerializedName(SERIALIZED_NAME_STAGE) + private String stage; + + public static final String SERIALIZED_NAME_APPLICANT_DETAILS = "applicantDetails"; + @SerializedName(SERIALIZED_NAME_APPLICANT_DETAILS) + private Prefilled applicantDetails; + + public static final String SERIALIZED_NAME_SETTINGS_OVERRIDE = "settingsOverride"; + @SerializedName(SERIALIZED_NAME_SETTINGS_OVERRIDE) + private SettingsOverride settingsOverride; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets allowedApplicationTypes + */ + @JsonAdapter(AllowedApplicationTypesEnum.Adapter.class) + public enum AllowedApplicationTypesEnum { + INDIVIDUAL("Individual"), + + BUSINESS("Business"), + + SOLEPROPRIETORSHIP("SoleProprietorship"); + + private String value; + + AllowedApplicationTypesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AllowedApplicationTypesEnum fromValue(String value) { + for (AllowedApplicationTypesEnum b : AllowedApplicationTypesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AllowedApplicationTypesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AllowedApplicationTypesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AllowedApplicationTypesEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ALLOWED_APPLICATION_TYPES = "allowedApplicationTypes"; + @SerializedName(SERIALIZED_NAME_ALLOWED_APPLICATION_TYPES) + private List allowedApplicationTypes; + + public ApplicationFormAttributes() { + } + + public ApplicationFormAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public ApplicationFormAttributes url(String url) { + + this.url = url; + return this; + } + + /** + * Get url + * @return url + **/ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + this.url = url; + } + + + public ApplicationFormAttributes stage(String stage) { + + this.stage = stage; + return this; + } + + /** + * Get stage + * @return stage + **/ + @javax.annotation.Nullable + public String getStage() { + return stage; + } + + + public void setStage(String stage) { + this.stage = stage; + } + + + public ApplicationFormAttributes applicantDetails(Prefilled applicantDetails) { + + this.applicantDetails = applicantDetails; + return this; + } + + /** + * Get applicantDetails + * @return applicantDetails + **/ + @javax.annotation.Nullable + public Prefilled getApplicantDetails() { + return applicantDetails; + } + + + public void setApplicantDetails(Prefilled applicantDetails) { + this.applicantDetails = applicantDetails; + } + + + public ApplicationFormAttributes settingsOverride(SettingsOverride settingsOverride) { + + this.settingsOverride = settingsOverride; + return this; + } + + /** + * Get settingsOverride + * @return settingsOverride + **/ + @javax.annotation.Nullable + public SettingsOverride getSettingsOverride() { + return settingsOverride; + } + + + public void setSettingsOverride(SettingsOverride settingsOverride) { + this.settingsOverride = settingsOverride; + } + + + public ApplicationFormAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public ApplicationFormAttributes allowedApplicationTypes(List allowedApplicationTypes) { + + this.allowedApplicationTypes = allowedApplicationTypes; + return this; + } + + public ApplicationFormAttributes addAllowedApplicationTypesItem(AllowedApplicationTypesEnum allowedApplicationTypesItem) { + if (this.allowedApplicationTypes == null) { + this.allowedApplicationTypes = new ArrayList<>(); + } + this.allowedApplicationTypes.add(allowedApplicationTypesItem); + return this; + } + + /** + * Get allowedApplicationTypes + * @return allowedApplicationTypes + **/ + @javax.annotation.Nullable + public List getAllowedApplicationTypes() { + return allowedApplicationTypes; + } + + + public void setAllowedApplicationTypes(List allowedApplicationTypes) { + this.allowedApplicationTypes = allowedApplicationTypes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationFormAttributes applicationFormAttributes = (ApplicationFormAttributes) o; + return Objects.equals(this.email, applicationFormAttributes.email) && + Objects.equals(this.url, applicationFormAttributes.url) && + Objects.equals(this.stage, applicationFormAttributes.stage) && + Objects.equals(this.applicantDetails, applicationFormAttributes.applicantDetails) && + Objects.equals(this.settingsOverride, applicationFormAttributes.settingsOverride) && + Objects.equals(this.tags, applicationFormAttributes.tags) && + Objects.equals(this.allowedApplicationTypes, applicationFormAttributes.allowedApplicationTypes); + } + + @Override + public int hashCode() { + return Objects.hash(email, url, stage, applicantDetails, settingsOverride, tags, allowedApplicationTypes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationFormAttributes {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" stage: ").append(toIndentedString(stage)).append("\n"); + sb.append(" applicantDetails: ").append(toIndentedString(applicantDetails)).append("\n"); + sb.append(" settingsOverride: ").append(toIndentedString(settingsOverride)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" allowedApplicationTypes: ").append(toIndentedString(allowedApplicationTypes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("url"); + openapiFields.add("stage"); + openapiFields.add("applicantDetails"); + openapiFields.add("settingsOverride"); + openapiFields.add("tags"); + openapiFields.add("allowedApplicationTypes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationFormAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationFormAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationFormAttributes is not found in the empty JSON string", ApplicationFormAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationFormAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationFormAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApplicationFormAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if ((jsonObj.get("stage") != null && !jsonObj.get("stage").isJsonNull()) && !jsonObj.get("stage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stage").toString())); + } + // validate the optional field `applicantDetails` + if (jsonObj.get("applicantDetails") != null && !jsonObj.get("applicantDetails").isJsonNull()) { + Prefilled.validateJsonElement(jsonObj.get("applicantDetails")); + } + // validate the optional field `settingsOverride` + if (jsonObj.get("settingsOverride") != null && !jsonObj.get("settingsOverride").isJsonNull()) { + SettingsOverride.validateJsonElement(jsonObj.get("settingsOverride")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("allowedApplicationTypes") != null && !jsonObj.get("allowedApplicationTypes").isJsonNull() && !jsonObj.get("allowedApplicationTypes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `allowedApplicationTypes` to be an array in the JSON string but got `%s`", jsonObj.get("allowedApplicationTypes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationFormAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationFormAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationFormAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationFormAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationFormAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationFormAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationFormAttributes + * @throws IOException if the JSON string is invalid with respect to ApplicationFormAttributes + */ + public static ApplicationFormAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationFormAttributes.class); + } + + /** + * Convert an instance of ApplicationFormAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationFormRelationships.java b/src/main/java/org/openapitools/client/model/ApplicationFormRelationships.java new file mode 100644 index 00000000..65ac200f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationFormRelationships.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApplicationFormRelationshipsApplication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationFormRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationFormRelationships { + public static final String SERIALIZED_NAME_APPLICATION = "application"; + @SerializedName(SERIALIZED_NAME_APPLICATION) + private ApplicationFormRelationshipsApplication application; + + public ApplicationFormRelationships() { + } + + public ApplicationFormRelationships application(ApplicationFormRelationshipsApplication application) { + + this.application = application; + return this; + } + + /** + * Get application + * @return application + **/ + @javax.annotation.Nullable + public ApplicationFormRelationshipsApplication getApplication() { + return application; + } + + + public void setApplication(ApplicationFormRelationshipsApplication application) { + this.application = application; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationFormRelationships applicationFormRelationships = (ApplicationFormRelationships) o; + return Objects.equals(this.application, applicationFormRelationships.application); + } + + @Override + public int hashCode() { + return Objects.hash(application); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationFormRelationships {\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("application"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationFormRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationFormRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationFormRelationships is not found in the empty JSON string", ApplicationFormRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationFormRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationFormRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `application` + if (jsonObj.get("application") != null && !jsonObj.get("application").isJsonNull()) { + ApplicationFormRelationshipsApplication.validateJsonElement(jsonObj.get("application")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationFormRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationFormRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationFormRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationFormRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationFormRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationFormRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationFormRelationships + * @throws IOException if the JSON string is invalid with respect to ApplicationFormRelationships + */ + public static ApplicationFormRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationFormRelationships.class); + } + + /** + * Convert an instance of ApplicationFormRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationFormRelationshipsApplication.java b/src/main/java/org/openapitools/client/model/ApplicationFormRelationshipsApplication.java new file mode 100644 index 00000000..e6155a12 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationFormRelationshipsApplication.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApplicationFormRelationshipsApplicationData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationFormRelationshipsApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationFormRelationshipsApplication { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ApplicationFormRelationshipsApplicationData data; + + public ApplicationFormRelationshipsApplication() { + } + + public ApplicationFormRelationshipsApplication data(ApplicationFormRelationshipsApplicationData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ApplicationFormRelationshipsApplicationData getData() { + return data; + } + + + public void setData(ApplicationFormRelationshipsApplicationData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationFormRelationshipsApplication applicationFormRelationshipsApplication = (ApplicationFormRelationshipsApplication) o; + return Objects.equals(this.data, applicationFormRelationshipsApplication.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationFormRelationshipsApplication {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationFormRelationshipsApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationFormRelationshipsApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationFormRelationshipsApplication is not found in the empty JSON string", ApplicationFormRelationshipsApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationFormRelationshipsApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationFormRelationshipsApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ApplicationFormRelationshipsApplicationData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationFormRelationshipsApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationFormRelationshipsApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationFormRelationshipsApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationFormRelationshipsApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationFormRelationshipsApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationFormRelationshipsApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationFormRelationshipsApplication + * @throws IOException if the JSON string is invalid with respect to ApplicationFormRelationshipsApplication + */ + public static ApplicationFormRelationshipsApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationFormRelationshipsApplication.class); + } + + /** + * Convert an instance of ApplicationFormRelationshipsApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationFormRelationshipsApplicationData.java b/src/main/java/org/openapitools/client/model/ApplicationFormRelationshipsApplicationData.java new file mode 100644 index 00000000..6f306210 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationFormRelationshipsApplicationData.java @@ -0,0 +1,284 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationFormRelationshipsApplicationData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationFormRelationshipsApplicationData { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + APPLICATION("application"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public ApplicationFormRelationshipsApplicationData() { + } + + public ApplicationFormRelationshipsApplicationData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ApplicationFormRelationshipsApplicationData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationFormRelationshipsApplicationData applicationFormRelationshipsApplicationData = (ApplicationFormRelationshipsApplicationData) o; + return Objects.equals(this.id, applicationFormRelationshipsApplicationData.id) && + Objects.equals(this.type, applicationFormRelationshipsApplicationData.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationFormRelationshipsApplicationData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationFormRelationshipsApplicationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationFormRelationshipsApplicationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationFormRelationshipsApplicationData is not found in the empty JSON string", ApplicationFormRelationshipsApplicationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationFormRelationshipsApplicationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationFormRelationshipsApplicationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationFormRelationshipsApplicationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationFormRelationshipsApplicationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationFormRelationshipsApplicationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationFormRelationshipsApplicationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationFormRelationshipsApplicationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationFormRelationshipsApplicationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationFormRelationshipsApplicationData + * @throws IOException if the JSON string is invalid with respect to ApplicationFormRelationshipsApplicationData + */ + public static ApplicationFormRelationshipsApplicationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationFormRelationshipsApplicationData.class); + } + + /** + * Convert an instance of ApplicationFormRelationshipsApplicationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationships.java b/src/main/java/org/openapitools/client/model/ApplicationRelationships.java new file mode 100644 index 00000000..6d2fafd9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationships.java @@ -0,0 +1,407 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApplicationRelationshipsBeneficialOwners; +import org.openapitools.client.model.ApplicationRelationshipsBeneficiaries; +import org.openapitools.client.model.ApplicationRelationshipsTrustees; +import org.openapitools.client.model.DocumentsRelationship; +import org.openapitools.client.model.OrgRelationship; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationships { + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private OrgRelationship org; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public static final String SERIALIZED_NAME_DOCUMENTS = "documents"; + @SerializedName(SERIALIZED_NAME_DOCUMENTS) + private DocumentsRelationship documents; + + public static final String SERIALIZED_NAME_APPLICATION_FORM = "applicationForm"; + @SerializedName(SERIALIZED_NAME_APPLICATION_FORM) + private Relationship applicationForm; + + public static final String SERIALIZED_NAME_TRUSTEES = "trustees"; + @SerializedName(SERIALIZED_NAME_TRUSTEES) + private ApplicationRelationshipsTrustees trustees; + + public static final String SERIALIZED_NAME_BENEFICIARIES = "beneficiaries"; + @SerializedName(SERIALIZED_NAME_BENEFICIARIES) + private ApplicationRelationshipsBeneficiaries beneficiaries; + + public static final String SERIALIZED_NAME_BENEFICIAL_OWNERS = "beneficialOwners"; + @SerializedName(SERIALIZED_NAME_BENEFICIAL_OWNERS) + private ApplicationRelationshipsBeneficialOwners beneficialOwners; + + public ApplicationRelationships() { + } + + public ApplicationRelationships org(OrgRelationship org) { + + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @javax.annotation.Nullable + public OrgRelationship getOrg() { + return org; + } + + + public void setOrg(OrgRelationship org) { + this.org = org; + } + + + public ApplicationRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + public ApplicationRelationships documents(DocumentsRelationship documents) { + + this.documents = documents; + return this; + } + + /** + * Get documents + * @return documents + **/ + @javax.annotation.Nullable + public DocumentsRelationship getDocuments() { + return documents; + } + + + public void setDocuments(DocumentsRelationship documents) { + this.documents = documents; + } + + + public ApplicationRelationships applicationForm(Relationship applicationForm) { + + this.applicationForm = applicationForm; + return this; + } + + /** + * Get applicationForm + * @return applicationForm + **/ + @javax.annotation.Nullable + public Relationship getApplicationForm() { + return applicationForm; + } + + + public void setApplicationForm(Relationship applicationForm) { + this.applicationForm = applicationForm; + } + + + public ApplicationRelationships trustees(ApplicationRelationshipsTrustees trustees) { + + this.trustees = trustees; + return this; + } + + /** + * Get trustees + * @return trustees + **/ + @javax.annotation.Nullable + public ApplicationRelationshipsTrustees getTrustees() { + return trustees; + } + + + public void setTrustees(ApplicationRelationshipsTrustees trustees) { + this.trustees = trustees; + } + + + public ApplicationRelationships beneficiaries(ApplicationRelationshipsBeneficiaries beneficiaries) { + + this.beneficiaries = beneficiaries; + return this; + } + + /** + * Get beneficiaries + * @return beneficiaries + **/ + @javax.annotation.Nullable + public ApplicationRelationshipsBeneficiaries getBeneficiaries() { + return beneficiaries; + } + + + public void setBeneficiaries(ApplicationRelationshipsBeneficiaries beneficiaries) { + this.beneficiaries = beneficiaries; + } + + + public ApplicationRelationships beneficialOwners(ApplicationRelationshipsBeneficialOwners beneficialOwners) { + + this.beneficialOwners = beneficialOwners; + return this; + } + + /** + * Get beneficialOwners + * @return beneficialOwners + **/ + @javax.annotation.Nullable + public ApplicationRelationshipsBeneficialOwners getBeneficialOwners() { + return beneficialOwners; + } + + + public void setBeneficialOwners(ApplicationRelationshipsBeneficialOwners beneficialOwners) { + this.beneficialOwners = beneficialOwners; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationships applicationRelationships = (ApplicationRelationships) o; + return Objects.equals(this.org, applicationRelationships.org) && + Objects.equals(this.customer, applicationRelationships.customer) && + Objects.equals(this.documents, applicationRelationships.documents) && + Objects.equals(this.applicationForm, applicationRelationships.applicationForm) && + Objects.equals(this.trustees, applicationRelationships.trustees) && + Objects.equals(this.beneficiaries, applicationRelationships.beneficiaries) && + Objects.equals(this.beneficialOwners, applicationRelationships.beneficialOwners); + } + + @Override + public int hashCode() { + return Objects.hash(org, customer, documents, applicationForm, trustees, beneficiaries, beneficialOwners); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationships {\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" documents: ").append(toIndentedString(documents)).append("\n"); + sb.append(" applicationForm: ").append(toIndentedString(applicationForm)).append("\n"); + sb.append(" trustees: ").append(toIndentedString(trustees)).append("\n"); + sb.append(" beneficiaries: ").append(toIndentedString(beneficiaries)).append("\n"); + sb.append(" beneficialOwners: ").append(toIndentedString(beneficialOwners)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("org"); + openapiFields.add("customer"); + openapiFields.add("documents"); + openapiFields.add("applicationForm"); + openapiFields.add("trustees"); + openapiFields.add("beneficiaries"); + openapiFields.add("beneficialOwners"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationships is not found in the empty JSON string", ApplicationRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `org` + if (jsonObj.get("org") != null && !jsonObj.get("org").isJsonNull()) { + OrgRelationship.validateJsonElement(jsonObj.get("org")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `documents` + if (jsonObj.get("documents") != null && !jsonObj.get("documents").isJsonNull()) { + DocumentsRelationship.validateJsonElement(jsonObj.get("documents")); + } + // validate the optional field `applicationForm` + if (jsonObj.get("applicationForm") != null && !jsonObj.get("applicationForm").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("applicationForm")); + } + // validate the optional field `trustees` + if (jsonObj.get("trustees") != null && !jsonObj.get("trustees").isJsonNull()) { + ApplicationRelationshipsTrustees.validateJsonElement(jsonObj.get("trustees")); + } + // validate the optional field `beneficiaries` + if (jsonObj.get("beneficiaries") != null && !jsonObj.get("beneficiaries").isJsonNull()) { + ApplicationRelationshipsBeneficiaries.validateJsonElement(jsonObj.get("beneficiaries")); + } + // validate the optional field `beneficialOwners` + if (jsonObj.get("beneficialOwners") != null && !jsonObj.get("beneficialOwners").isJsonNull()) { + ApplicationRelationshipsBeneficialOwners.validateJsonElement(jsonObj.get("beneficialOwners")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationships + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationships + */ + public static ApplicationRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationships.class); + } + + /** + * Convert an instance of ApplicationRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficialOwners.java b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficialOwners.java new file mode 100644 index 00000000..cb0a2b19 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficialOwners.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApplicationRelationshipsBeneficialOwnersDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationshipsBeneficialOwners + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationshipsBeneficialOwners { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public ApplicationRelationshipsBeneficialOwners() { + } + + public ApplicationRelationshipsBeneficialOwners data(List data) { + + this.data = data; + return this; + } + + public ApplicationRelationshipsBeneficialOwners addDataItem(ApplicationRelationshipsBeneficialOwnersDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationshipsBeneficialOwners applicationRelationshipsBeneficialOwners = (ApplicationRelationshipsBeneficialOwners) o; + return Objects.equals(this.data, applicationRelationshipsBeneficialOwners.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationshipsBeneficialOwners {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationshipsBeneficialOwners + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationshipsBeneficialOwners.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationshipsBeneficialOwners is not found in the empty JSON string", ApplicationRelationshipsBeneficialOwners.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationshipsBeneficialOwners.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationshipsBeneficialOwners` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ApplicationRelationshipsBeneficialOwnersDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationshipsBeneficialOwners.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationshipsBeneficialOwners' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationshipsBeneficialOwners.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationshipsBeneficialOwners value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationshipsBeneficialOwners read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationshipsBeneficialOwners given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationshipsBeneficialOwners + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationshipsBeneficialOwners + */ + public static ApplicationRelationshipsBeneficialOwners fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationshipsBeneficialOwners.class); + } + + /** + * Convert an instance of ApplicationRelationshipsBeneficialOwners to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficialOwnersDataInner.java b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficialOwnersDataInner.java new file mode 100644 index 00000000..069c384b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficialOwnersDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationshipsBeneficialOwnersDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationshipsBeneficialOwnersDataInner { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "beneficialOwner"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ApplicationRelationshipsBeneficialOwnersDataInner() { + } + + public ApplicationRelationshipsBeneficialOwnersDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ApplicationRelationshipsBeneficialOwnersDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationshipsBeneficialOwnersDataInner applicationRelationshipsBeneficialOwnersDataInner = (ApplicationRelationshipsBeneficialOwnersDataInner) o; + return Objects.equals(this.type, applicationRelationshipsBeneficialOwnersDataInner.type) && + Objects.equals(this.id, applicationRelationshipsBeneficialOwnersDataInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationshipsBeneficialOwnersDataInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationshipsBeneficialOwnersDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationshipsBeneficialOwnersDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationshipsBeneficialOwnersDataInner is not found in the empty JSON string", ApplicationRelationshipsBeneficialOwnersDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationshipsBeneficialOwnersDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationshipsBeneficialOwnersDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationshipsBeneficialOwnersDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationshipsBeneficialOwnersDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationshipsBeneficialOwnersDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationshipsBeneficialOwnersDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationshipsBeneficialOwnersDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationshipsBeneficialOwnersDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationshipsBeneficialOwnersDataInner + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationshipsBeneficialOwnersDataInner + */ + public static ApplicationRelationshipsBeneficialOwnersDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationshipsBeneficialOwnersDataInner.class); + } + + /** + * Convert an instance of ApplicationRelationshipsBeneficialOwnersDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficiaries.java b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficiaries.java new file mode 100644 index 00000000..920141fe --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficiaries.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApplicationRelationshipsBeneficiariesDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationshipsBeneficiaries + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationshipsBeneficiaries { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public ApplicationRelationshipsBeneficiaries() { + } + + public ApplicationRelationshipsBeneficiaries data(List data) { + + this.data = data; + return this; + } + + public ApplicationRelationshipsBeneficiaries addDataItem(ApplicationRelationshipsBeneficiariesDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationshipsBeneficiaries applicationRelationshipsBeneficiaries = (ApplicationRelationshipsBeneficiaries) o; + return Objects.equals(this.data, applicationRelationshipsBeneficiaries.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationshipsBeneficiaries {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationshipsBeneficiaries + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationshipsBeneficiaries.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationshipsBeneficiaries is not found in the empty JSON string", ApplicationRelationshipsBeneficiaries.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationshipsBeneficiaries.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationshipsBeneficiaries` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ApplicationRelationshipsBeneficiariesDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationshipsBeneficiaries.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationshipsBeneficiaries' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationshipsBeneficiaries.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationshipsBeneficiaries value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationshipsBeneficiaries read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationshipsBeneficiaries given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationshipsBeneficiaries + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationshipsBeneficiaries + */ + public static ApplicationRelationshipsBeneficiaries fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationshipsBeneficiaries.class); + } + + /** + * Convert an instance of ApplicationRelationshipsBeneficiaries to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficiariesDataInner.java b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficiariesDataInner.java new file mode 100644 index 00000000..913109f6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsBeneficiariesDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationshipsBeneficiariesDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationshipsBeneficiariesDataInner { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "beneficiary"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ApplicationRelationshipsBeneficiariesDataInner() { + } + + public ApplicationRelationshipsBeneficiariesDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ApplicationRelationshipsBeneficiariesDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationshipsBeneficiariesDataInner applicationRelationshipsBeneficiariesDataInner = (ApplicationRelationshipsBeneficiariesDataInner) o; + return Objects.equals(this.type, applicationRelationshipsBeneficiariesDataInner.type) && + Objects.equals(this.id, applicationRelationshipsBeneficiariesDataInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationshipsBeneficiariesDataInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationshipsBeneficiariesDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationshipsBeneficiariesDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationshipsBeneficiariesDataInner is not found in the empty JSON string", ApplicationRelationshipsBeneficiariesDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationshipsBeneficiariesDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationshipsBeneficiariesDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationshipsBeneficiariesDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationshipsBeneficiariesDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationshipsBeneficiariesDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationshipsBeneficiariesDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationshipsBeneficiariesDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationshipsBeneficiariesDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationshipsBeneficiariesDataInner + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationshipsBeneficiariesDataInner + */ + public static ApplicationRelationshipsBeneficiariesDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationshipsBeneficiariesDataInner.class); + } + + /** + * Convert an instance of ApplicationRelationshipsBeneficiariesDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationshipsTrustees.java b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsTrustees.java new file mode 100644 index 00000000..bc2dda79 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsTrustees.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApplicationRelationshipsTrusteesDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationshipsTrustees + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationshipsTrustees { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public ApplicationRelationshipsTrustees() { + } + + public ApplicationRelationshipsTrustees data(List data) { + + this.data = data; + return this; + } + + public ApplicationRelationshipsTrustees addDataItem(ApplicationRelationshipsTrusteesDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationshipsTrustees applicationRelationshipsTrustees = (ApplicationRelationshipsTrustees) o; + return Objects.equals(this.data, applicationRelationshipsTrustees.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationshipsTrustees {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationshipsTrustees + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationshipsTrustees.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationshipsTrustees is not found in the empty JSON string", ApplicationRelationshipsTrustees.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationshipsTrustees.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationshipsTrustees` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ApplicationRelationshipsTrusteesDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationshipsTrustees.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationshipsTrustees' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationshipsTrustees.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationshipsTrustees value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationshipsTrustees read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationshipsTrustees given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationshipsTrustees + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationshipsTrustees + */ + public static ApplicationRelationshipsTrustees fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationshipsTrustees.class); + } + + /** + * Convert an instance of ApplicationRelationshipsTrustees to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationRelationshipsTrusteesDataInner.java b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsTrusteesDataInner.java new file mode 100644 index 00000000..462d1915 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationRelationshipsTrusteesDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApplicationRelationshipsTrusteesDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApplicationRelationshipsTrusteesDataInner { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "trustee"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ApplicationRelationshipsTrusteesDataInner() { + } + + public ApplicationRelationshipsTrusteesDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ApplicationRelationshipsTrusteesDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationRelationshipsTrusteesDataInner applicationRelationshipsTrusteesDataInner = (ApplicationRelationshipsTrusteesDataInner) o; + return Objects.equals(this.type, applicationRelationshipsTrusteesDataInner.type) && + Objects.equals(this.id, applicationRelationshipsTrusteesDataInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationRelationshipsTrusteesDataInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationRelationshipsTrusteesDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationRelationshipsTrusteesDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationRelationshipsTrusteesDataInner is not found in the empty JSON string", ApplicationRelationshipsTrusteesDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationRelationshipsTrusteesDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationRelationshipsTrusteesDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationRelationshipsTrusteesDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationRelationshipsTrusteesDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationRelationshipsTrusteesDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationRelationshipsTrusteesDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationRelationshipsTrusteesDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationRelationshipsTrusteesDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationRelationshipsTrusteesDataInner + * @throws IOException if the JSON string is invalid with respect to ApplicationRelationshipsTrusteesDataInner + */ + public static ApplicationRelationshipsTrusteesDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationRelationshipsTrusteesDataInner.class); + } + + /** + * Convert an instance of ApplicationRelationshipsTrusteesDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApplicationStatus.java b/src/main/java/org/openapitools/client/model/ApplicationStatus.java new file mode 100644 index 00000000..12d43d6e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApplicationStatus.java @@ -0,0 +1,80 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets applicationStatus + */ +@JsonAdapter(ApplicationStatus.Adapter.class) +public enum ApplicationStatus { + + AWAITINGDOCUMENTS("AwaitingDocuments"), + + PENDINGREVIEW("PendingReview"), + + APPROVED("Approved"), + + DENIED("Denied"), + + PENDING("Pending"), + + CANCELED("Canceled"); + + private String value; + + ApplicationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ApplicationStatus fromValue(String value) { + for (ApplicationStatus b : ApplicationStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ApplicationStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ApplicationStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ApplicationStatus.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApproveAuthorizationRequest.java b/src/main/java/org/openapitools/client/model/ApproveAuthorizationRequest.java new file mode 100644 index 00000000..845016de --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApproveAuthorizationRequest.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApproveAuthorizationRequestAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApproveAuthorizationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApproveAuthorizationRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "approveAuthorizationRequest"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ApproveAuthorizationRequestAttributes attributes; + + public ApproveAuthorizationRequest() { + } + + public ApproveAuthorizationRequest type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ApproveAuthorizationRequest attributes(ApproveAuthorizationRequestAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ApproveAuthorizationRequestAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ApproveAuthorizationRequestAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApproveAuthorizationRequest approveAuthorizationRequest = (ApproveAuthorizationRequest) o; + return Objects.equals(this.type, approveAuthorizationRequest.type) && + Objects.equals(this.attributes, approveAuthorizationRequest.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApproveAuthorizationRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApproveAuthorizationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApproveAuthorizationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApproveAuthorizationRequest is not found in the empty JSON string", ApproveAuthorizationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApproveAuthorizationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApproveAuthorizationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApproveAuthorizationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + ApproveAuthorizationRequestAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApproveAuthorizationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApproveAuthorizationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApproveAuthorizationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApproveAuthorizationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApproveAuthorizationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApproveAuthorizationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApproveAuthorizationRequest + * @throws IOException if the JSON string is invalid with respect to ApproveAuthorizationRequest + */ + public static ApproveAuthorizationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApproveAuthorizationRequest.class); + } + + /** + * Convert an instance of ApproveAuthorizationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ApproveAuthorizationRequestAttributes.java b/src/main/java/org/openapitools/client/model/ApproveAuthorizationRequestAttributes.java new file mode 100644 index 00000000..fc12ba94 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ApproveAuthorizationRequestAttributes.java @@ -0,0 +1,264 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ApproveAuthorizationRequestAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApproveAuthorizationRequestAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_FUNDING_ACCOUNT = "fundingAccount"; + @SerializedName(SERIALIZED_NAME_FUNDING_ACCOUNT) + private String fundingAccount; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ApproveAuthorizationRequestAttributes() { + } + + public ApproveAuthorizationRequestAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nullable + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ApproveAuthorizationRequestAttributes fundingAccount(String fundingAccount) { + + this.fundingAccount = fundingAccount; + return this; + } + + /** + * Get fundingAccount + * @return fundingAccount + **/ + @javax.annotation.Nullable + public String getFundingAccount() { + return fundingAccount; + } + + + public void setFundingAccount(String fundingAccount) { + this.fundingAccount = fundingAccount; + } + + + public ApproveAuthorizationRequestAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApproveAuthorizationRequestAttributes approveAuthorizationRequestAttributes = (ApproveAuthorizationRequestAttributes) o; + return Objects.equals(this.amount, approveAuthorizationRequestAttributes.amount) && + Objects.equals(this.fundingAccount, approveAuthorizationRequestAttributes.fundingAccount) && + Objects.equals(this.tags, approveAuthorizationRequestAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, fundingAccount, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApproveAuthorizationRequestAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" fundingAccount: ").append(toIndentedString(fundingAccount)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("fundingAccount"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApproveAuthorizationRequestAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApproveAuthorizationRequestAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApproveAuthorizationRequestAttributes is not found in the empty JSON string", ApproveAuthorizationRequestAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApproveAuthorizationRequestAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApproveAuthorizationRequestAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("fundingAccount") != null && !jsonObj.get("fundingAccount").isJsonNull()) && !jsonObj.get("fundingAccount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fundingAccount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fundingAccount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApproveAuthorizationRequestAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApproveAuthorizationRequestAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApproveAuthorizationRequestAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApproveAuthorizationRequestAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApproveAuthorizationRequestAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApproveAuthorizationRequestAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApproveAuthorizationRequestAttributes + * @throws IOException if the JSON string is invalid with respect to ApproveAuthorizationRequestAttributes + */ + public static ApproveAuthorizationRequestAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApproveAuthorizationRequestAttributes.class); + } + + /** + * Convert an instance of ApproveAuthorizationRequestAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Astra.java b/src/main/java/org/openapitools/client/model/Astra.java new file mode 100644 index 00000000..d55ad8fe --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Astra.java @@ -0,0 +1,436 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Astra + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Astra { + public static final String SERIALIZED_NAME_AUTH_TOKEN = "authToken"; + @SerializedName(SERIALIZED_NAME_AUTH_TOKEN) + private String authToken; + + public static final String SERIALIZED_NAME_DEBIT_FEE_PERCENT = "debitFeePercent"; + @SerializedName(SERIALIZED_NAME_DEBIT_FEE_PERCENT) + private BigDecimal debitFeePercent; + + public static final String SERIALIZED_NAME_INSTITUTION_ID = "institutionId"; + @SerializedName(SERIALIZED_NAME_INSTITUTION_ID) + private String institutionId; + + public static final String SERIALIZED_NAME_DESTINATION_CARD_ID = "destinationCardId"; + @SerializedName(SERIALIZED_NAME_DESTINATION_CARD_ID) + private String destinationCardId; + + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NAME = "accountName"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NAME) + private String accountName; + + public static final String SERIALIZED_NAME_REFERENCE_ID = "referenceId"; + @SerializedName(SERIALIZED_NAME_REFERENCE_ID) + private String referenceId; + + public Astra() { + } + + public Astra authToken(String authToken) { + + this.authToken = authToken; + return this; + } + + /** + * Get authToken + * @return authToken + **/ + @javax.annotation.Nullable + public String getAuthToken() { + return authToken; + } + + + public void setAuthToken(String authToken) { + this.authToken = authToken; + } + + + public Astra debitFeePercent(BigDecimal debitFeePercent) { + + this.debitFeePercent = debitFeePercent; + return this; + } + + /** + * Get debitFeePercent + * @return debitFeePercent + **/ + @javax.annotation.Nonnull + public BigDecimal getDebitFeePercent() { + return debitFeePercent; + } + + + public void setDebitFeePercent(BigDecimal debitFeePercent) { + this.debitFeePercent = debitFeePercent; + } + + + public Astra institutionId(String institutionId) { + + this.institutionId = institutionId; + return this; + } + + /** + * Get institutionId + * @return institutionId + **/ + @javax.annotation.Nonnull + public String getInstitutionId() { + return institutionId; + } + + + public void setInstitutionId(String institutionId) { + this.institutionId = institutionId; + } + + + public Astra destinationCardId(String destinationCardId) { + + this.destinationCardId = destinationCardId; + return this; + } + + /** + * Get destinationCardId + * @return destinationCardId + **/ + @javax.annotation.Nonnull + public String getDestinationCardId() { + return destinationCardId; + } + + + public void setDestinationCardId(String destinationCardId) { + this.destinationCardId = destinationCardId; + } + + + public Astra routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public Astra accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public Astra accountName(String accountName) { + + this.accountName = accountName; + return this; + } + + /** + * Get accountName + * @return accountName + **/ + @javax.annotation.Nullable + public String getAccountName() { + return accountName; + } + + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + + public Astra referenceId(String referenceId) { + + this.referenceId = referenceId; + return this; + } + + /** + * Get referenceId + * @return referenceId + **/ + @javax.annotation.Nonnull + public String getReferenceId() { + return referenceId; + } + + + public void setReferenceId(String referenceId) { + this.referenceId = referenceId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Astra astra = (Astra) o; + return Objects.equals(this.authToken, astra.authToken) && + Objects.equals(this.debitFeePercent, astra.debitFeePercent) && + Objects.equals(this.institutionId, astra.institutionId) && + Objects.equals(this.destinationCardId, astra.destinationCardId) && + Objects.equals(this.routingNumber, astra.routingNumber) && + Objects.equals(this.accountNumber, astra.accountNumber) && + Objects.equals(this.accountName, astra.accountName) && + Objects.equals(this.referenceId, astra.referenceId); + } + + @Override + public int hashCode() { + return Objects.hash(authToken, debitFeePercent, institutionId, destinationCardId, routingNumber, accountNumber, accountName, referenceId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Astra {\n"); + sb.append(" authToken: ").append(toIndentedString(authToken)).append("\n"); + sb.append(" debitFeePercent: ").append(toIndentedString(debitFeePercent)).append("\n"); + sb.append(" institutionId: ").append(toIndentedString(institutionId)).append("\n"); + sb.append(" destinationCardId: ").append(toIndentedString(destinationCardId)).append("\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" accountName: ").append(toIndentedString(accountName)).append("\n"); + sb.append(" referenceId: ").append(toIndentedString(referenceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("authToken"); + openapiFields.add("debitFeePercent"); + openapiFields.add("institutionId"); + openapiFields.add("destinationCardId"); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("accountName"); + openapiFields.add("referenceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("debitFeePercent"); + openapiRequiredFields.add("institutionId"); + openapiRequiredFields.add("destinationCardId"); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("referenceId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Astra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Astra.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Astra is not found in the empty JSON string", Astra.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Astra.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Astra` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Astra.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("authToken") != null && !jsonObj.get("authToken").isJsonNull()) && !jsonObj.get("authToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `authToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("authToken").toString())); + } + if (!jsonObj.get("institutionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `institutionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("institutionId").toString())); + } + if (!jsonObj.get("destinationCardId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `destinationCardId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationCardId").toString())); + } + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if ((jsonObj.get("accountName") != null && !jsonObj.get("accountName").isJsonNull()) && !jsonObj.get("accountName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountName").toString())); + } + if (!jsonObj.get("referenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referenceId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Astra.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Astra' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Astra.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Astra value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Astra read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Astra given an JSON string + * + * @param jsonString JSON string + * @return An instance of Astra + * @throws IOException if the JSON string is invalid with respect to Astra + */ + public static Astra fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Astra.class); + } + + /** + * Convert an instance of Astra to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AtmAuthorizationRequest.java b/src/main/java/org/openapitools/client/model/AtmAuthorizationRequest.java new file mode 100644 index 00000000..534e1682 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AtmAuthorizationRequest.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AtmAuthorizationRequestAllOfAttributes; +import org.openapitools.client.model.AuthorizationRequest; +import org.openapitools.client.model.AuthorizationRequestRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AtmAuthorizationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AtmAuthorizationRequest extends AuthorizationRequest { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AtmAuthorizationRequestAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private AuthorizationRequestRelationships relationships; + + public AtmAuthorizationRequest() { + this.type = this.getClass().getSimpleName(); + } + + public AtmAuthorizationRequest attributes(AtmAuthorizationRequestAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public AtmAuthorizationRequestAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AtmAuthorizationRequestAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public AtmAuthorizationRequest relationships(AuthorizationRequestRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(AuthorizationRequestRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AtmAuthorizationRequest atmAuthorizationRequest = (AtmAuthorizationRequest) o; + return Objects.equals(this.attributes, atmAuthorizationRequest.attributes) && + Objects.equals(this.relationships, atmAuthorizationRequest.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AtmAuthorizationRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AtmAuthorizationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AtmAuthorizationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AtmAuthorizationRequest is not found in the empty JSON string", AtmAuthorizationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AtmAuthorizationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AtmAuthorizationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AtmAuthorizationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AtmAuthorizationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AtmAuthorizationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AtmAuthorizationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AtmAuthorizationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AtmAuthorizationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AtmAuthorizationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AtmAuthorizationRequest + * @throws IOException if the JSON string is invalid with respect to AtmAuthorizationRequest + */ + public static AtmAuthorizationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AtmAuthorizationRequest.class); + } + + /** + * Convert an instance of AtmAuthorizationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AtmAuthorizationRequestAllOfAttributes.java b/src/main/java/org/openapitools/client/model/AtmAuthorizationRequestAllOfAttributes.java new file mode 100644 index 00000000..f4f7a317 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AtmAuthorizationRequestAllOfAttributes.java @@ -0,0 +1,587 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AtmAuthorizationRequestAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AtmAuthorizationRequestAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_PARTIAL_APPROVAL_ALLOWED = "partialApprovalAllowed"; + @SerializedName(SERIALIZED_NAME_PARTIAL_APPROVAL_ALLOWED) + private Boolean partialApprovalAllowed; + + public static final String SERIALIZED_NAME_APPROVED_AMOUNT = "approvedAmount"; + @SerializedName(SERIALIZED_NAME_APPROVED_AMOUNT) + private Integer approvedAmount; + + public static final String SERIALIZED_NAME_DECLINE_REASON = "declineReason"; + @SerializedName(SERIALIZED_NAME_DECLINE_REASON) + private String declineReason; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private String direction; + + public static final String SERIALIZED_NAME_ATM_NAME = "atmName"; + @SerializedName(SERIALIZED_NAME_ATM_NAME) + private String atmName; + + public static final String SERIALIZED_NAME_ATM_LOCATION = "atmLocation"; + @SerializedName(SERIALIZED_NAME_ATM_LOCATION) + private String atmLocation; + + public static final String SERIALIZED_NAME_SURCHARGE = "surcharge"; + @SerializedName(SERIALIZED_NAME_SURCHARGE) + private Integer surcharge; + + public static final String SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE = "internationalServiceFee"; + @SerializedName(SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE) + private BigDecimal internationalServiceFee; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public AtmAuthorizationRequestAllOfAttributes() { + } + + public AtmAuthorizationRequestAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AtmAuthorizationRequestAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AtmAuthorizationRequestAllOfAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public AtmAuthorizationRequestAllOfAttributes partialApprovalAllowed(Boolean partialApprovalAllowed) { + + this.partialApprovalAllowed = partialApprovalAllowed; + return this; + } + + /** + * Get partialApprovalAllowed + * @return partialApprovalAllowed + **/ + @javax.annotation.Nonnull + public Boolean getPartialApprovalAllowed() { + return partialApprovalAllowed; + } + + + public void setPartialApprovalAllowed(Boolean partialApprovalAllowed) { + this.partialApprovalAllowed = partialApprovalAllowed; + } + + + public AtmAuthorizationRequestAllOfAttributes approvedAmount(Integer approvedAmount) { + + this.approvedAmount = approvedAmount; + return this; + } + + /** + * Get approvedAmount + * @return approvedAmount + **/ + @javax.annotation.Nullable + public Integer getApprovedAmount() { + return approvedAmount; + } + + + public void setApprovedAmount(Integer approvedAmount) { + this.approvedAmount = approvedAmount; + } + + + public AtmAuthorizationRequestAllOfAttributes declineReason(String declineReason) { + + this.declineReason = declineReason; + return this; + } + + /** + * Get declineReason + * @return declineReason + **/ + @javax.annotation.Nullable + public String getDeclineReason() { + return declineReason; + } + + + public void setDeclineReason(String declineReason) { + this.declineReason = declineReason; + } + + + public AtmAuthorizationRequestAllOfAttributes direction(String direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + + public void setDirection(String direction) { + this.direction = direction; + } + + + public AtmAuthorizationRequestAllOfAttributes atmName(String atmName) { + + this.atmName = atmName; + return this; + } + + /** + * Get atmName + * @return atmName + **/ + @javax.annotation.Nonnull + public String getAtmName() { + return atmName; + } + + + public void setAtmName(String atmName) { + this.atmName = atmName; + } + + + public AtmAuthorizationRequestAllOfAttributes atmLocation(String atmLocation) { + + this.atmLocation = atmLocation; + return this; + } + + /** + * Get atmLocation + * @return atmLocation + **/ + @javax.annotation.Nullable + public String getAtmLocation() { + return atmLocation; + } + + + public void setAtmLocation(String atmLocation) { + this.atmLocation = atmLocation; + } + + + public AtmAuthorizationRequestAllOfAttributes surcharge(Integer surcharge) { + + this.surcharge = surcharge; + return this; + } + + /** + * Get surcharge + * @return surcharge + **/ + @javax.annotation.Nonnull + public Integer getSurcharge() { + return surcharge; + } + + + public void setSurcharge(Integer surcharge) { + this.surcharge = surcharge; + } + + + public AtmAuthorizationRequestAllOfAttributes internationalServiceFee(BigDecimal internationalServiceFee) { + + this.internationalServiceFee = internationalServiceFee; + return this; + } + + /** + * Get internationalServiceFee + * @return internationalServiceFee + **/ + @javax.annotation.Nullable + public BigDecimal getInternationalServiceFee() { + return internationalServiceFee; + } + + + public void setInternationalServiceFee(BigDecimal internationalServiceFee) { + this.internationalServiceFee = internationalServiceFee; + } + + + public AtmAuthorizationRequestAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public AtmAuthorizationRequestAllOfAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AtmAuthorizationRequestAllOfAttributes atmAuthorizationRequestAllOfAttributes = (AtmAuthorizationRequestAllOfAttributes) o; + return Objects.equals(this.createdAt, atmAuthorizationRequestAllOfAttributes.createdAt) && + Objects.equals(this.amount, atmAuthorizationRequestAllOfAttributes.amount) && + Objects.equals(this.status, atmAuthorizationRequestAllOfAttributes.status) && + Objects.equals(this.partialApprovalAllowed, atmAuthorizationRequestAllOfAttributes.partialApprovalAllowed) && + Objects.equals(this.approvedAmount, atmAuthorizationRequestAllOfAttributes.approvedAmount) && + Objects.equals(this.declineReason, atmAuthorizationRequestAllOfAttributes.declineReason) && + Objects.equals(this.direction, atmAuthorizationRequestAllOfAttributes.direction) && + Objects.equals(this.atmName, atmAuthorizationRequestAllOfAttributes.atmName) && + Objects.equals(this.atmLocation, atmAuthorizationRequestAllOfAttributes.atmLocation) && + Objects.equals(this.surcharge, atmAuthorizationRequestAllOfAttributes.surcharge) && + Objects.equals(this.internationalServiceFee, atmAuthorizationRequestAllOfAttributes.internationalServiceFee) && + Objects.equals(this.tags, atmAuthorizationRequestAllOfAttributes.tags) && + Objects.equals(this.cardNetwork, atmAuthorizationRequestAllOfAttributes.cardNetwork); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, status, partialApprovalAllowed, approvedAmount, declineReason, direction, atmName, atmLocation, surcharge, internationalServiceFee, tags, cardNetwork); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AtmAuthorizationRequestAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" partialApprovalAllowed: ").append(toIndentedString(partialApprovalAllowed)).append("\n"); + sb.append(" approvedAmount: ").append(toIndentedString(approvedAmount)).append("\n"); + sb.append(" declineReason: ").append(toIndentedString(declineReason)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" atmName: ").append(toIndentedString(atmName)).append("\n"); + sb.append(" atmLocation: ").append(toIndentedString(atmLocation)).append("\n"); + sb.append(" surcharge: ").append(toIndentedString(surcharge)).append("\n"); + sb.append(" internationalServiceFee: ").append(toIndentedString(internationalServiceFee)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("status"); + openapiFields.add("partialApprovalAllowed"); + openapiFields.add("approvedAmount"); + openapiFields.add("declineReason"); + openapiFields.add("direction"); + openapiFields.add("atmName"); + openapiFields.add("atmLocation"); + openapiFields.add("surcharge"); + openapiFields.add("internationalServiceFee"); + openapiFields.add("tags"); + openapiFields.add("cardNetwork"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("partialApprovalAllowed"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("atmName"); + openapiRequiredFields.add("surcharge"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AtmAuthorizationRequestAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AtmAuthorizationRequestAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AtmAuthorizationRequestAllOfAttributes is not found in the empty JSON string", AtmAuthorizationRequestAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AtmAuthorizationRequestAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AtmAuthorizationRequestAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AtmAuthorizationRequestAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("declineReason") != null && !jsonObj.get("declineReason").isJsonNull()) && !jsonObj.get("declineReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `declineReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("declineReason").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("atmName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `atmName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("atmName").toString())); + } + if ((jsonObj.get("atmLocation") != null && !jsonObj.get("atmLocation").isJsonNull()) && !jsonObj.get("atmLocation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `atmLocation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("atmLocation").toString())); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AtmAuthorizationRequestAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AtmAuthorizationRequestAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AtmAuthorizationRequestAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AtmAuthorizationRequestAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AtmAuthorizationRequestAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AtmAuthorizationRequestAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AtmAuthorizationRequestAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AtmAuthorizationRequestAllOfAttributes + */ + public static AtmAuthorizationRequestAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AtmAuthorizationRequestAllOfAttributes.class); + } + + /** + * Convert an instance of AtmAuthorizationRequestAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AtmTransaction.java b/src/main/java/org/openapitools/client/model/AtmTransaction.java new file mode 100644 index 00000000..b84af09e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AtmTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AtmTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AtmTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AtmTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AtmTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public AtmTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public AtmTransaction attributes(AtmTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public AtmTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AtmTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public AtmTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AtmTransaction atmTransaction = (AtmTransaction) o; + return Objects.equals(this.attributes, atmTransaction.attributes) && + Objects.equals(this.relationships, atmTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AtmTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AtmTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AtmTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AtmTransaction is not found in the empty JSON string", AtmTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AtmTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AtmTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AtmTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AtmTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AtmTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AtmTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AtmTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AtmTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AtmTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of AtmTransaction + * @throws IOException if the JSON string is invalid with respect to AtmTransaction + */ + public static AtmTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AtmTransaction.class); + } + + /** + * Convert an instance of AtmTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AtmTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/AtmTransactionAllOfAttributes.java new file mode 100644 index 00000000..d7ab47f9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AtmTransactionAllOfAttributes.java @@ -0,0 +1,668 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AtmTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AtmTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_CARD_LAST4_DIGITS = "cardLast4Digits"; + @SerializedName(SERIALIZED_NAME_CARD_LAST4_DIGITS) + private String cardLast4Digits; + + public static final String SERIALIZED_NAME_ATM_NAME = "atmName"; + @SerializedName(SERIALIZED_NAME_ATM_NAME) + private String atmName; + + public static final String SERIALIZED_NAME_ATM_LOCATION = "atmLocation"; + @SerializedName(SERIALIZED_NAME_ATM_LOCATION) + private String atmLocation; + + public static final String SERIALIZED_NAME_SURCHARGE = "surcharge"; + @SerializedName(SERIALIZED_NAME_SURCHARGE) + private Integer surcharge; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_NETWORK_TRANSACTION_ID = "networkTransactionId"; + @SerializedName(SERIALIZED_NAME_NETWORK_TRANSACTION_ID) + private String networkTransactionId; + + public static final String SERIALIZED_NAME_INTERCHANGE = "interchange"; + @SerializedName(SERIALIZED_NAME_INTERCHANGE) + private String interchange; + + public static final String SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE = "internationalServiceFee"; + @SerializedName(SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE) + private Integer internationalServiceFee; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public AtmTransactionAllOfAttributes() { + } + + public AtmTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AtmTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public AtmTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AtmTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public AtmTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public AtmTransactionAllOfAttributes cardLast4Digits(String cardLast4Digits) { + + this.cardLast4Digits = cardLast4Digits; + return this; + } + + /** + * Get cardLast4Digits + * @return cardLast4Digits + **/ + @javax.annotation.Nonnull + public String getCardLast4Digits() { + return cardLast4Digits; + } + + + public void setCardLast4Digits(String cardLast4Digits) { + this.cardLast4Digits = cardLast4Digits; + } + + + public AtmTransactionAllOfAttributes atmName(String atmName) { + + this.atmName = atmName; + return this; + } + + /** + * Get atmName + * @return atmName + **/ + @javax.annotation.Nonnull + public String getAtmName() { + return atmName; + } + + + public void setAtmName(String atmName) { + this.atmName = atmName; + } + + + public AtmTransactionAllOfAttributes atmLocation(String atmLocation) { + + this.atmLocation = atmLocation; + return this; + } + + /** + * Get atmLocation + * @return atmLocation + **/ + @javax.annotation.Nullable + public String getAtmLocation() { + return atmLocation; + } + + + public void setAtmLocation(String atmLocation) { + this.atmLocation = atmLocation; + } + + + public AtmTransactionAllOfAttributes surcharge(Integer surcharge) { + + this.surcharge = surcharge; + return this; + } + + /** + * Get surcharge + * @return surcharge + **/ + @javax.annotation.Nonnull + public Integer getSurcharge() { + return surcharge; + } + + + public void setSurcharge(Integer surcharge) { + this.surcharge = surcharge; + } + + + public AtmTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public AtmTransactionAllOfAttributes networkTransactionId(String networkTransactionId) { + + this.networkTransactionId = networkTransactionId; + return this; + } + + /** + * Get networkTransactionId + * @return networkTransactionId + **/ + @javax.annotation.Nullable + public String getNetworkTransactionId() { + return networkTransactionId; + } + + + public void setNetworkTransactionId(String networkTransactionId) { + this.networkTransactionId = networkTransactionId; + } + + + public AtmTransactionAllOfAttributes interchange(String interchange) { + + this.interchange = interchange; + return this; + } + + /** + * Get interchange + * @return interchange + **/ + @javax.annotation.Nullable + public String getInterchange() { + return interchange; + } + + + public void setInterchange(String interchange) { + this.interchange = interchange; + } + + + public AtmTransactionAllOfAttributes internationalServiceFee(Integer internationalServiceFee) { + + this.internationalServiceFee = internationalServiceFee; + return this; + } + + /** + * Get internationalServiceFee + * @return internationalServiceFee + **/ + @javax.annotation.Nullable + public Integer getInternationalServiceFee() { + return internationalServiceFee; + } + + + public void setInternationalServiceFee(Integer internationalServiceFee) { + this.internationalServiceFee = internationalServiceFee; + } + + + public AtmTransactionAllOfAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AtmTransactionAllOfAttributes atmTransactionAllOfAttributes = (AtmTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, atmTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, atmTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, atmTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, atmTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, atmTransactionAllOfAttributes.summary) && + Objects.equals(this.cardLast4Digits, atmTransactionAllOfAttributes.cardLast4Digits) && + Objects.equals(this.atmName, atmTransactionAllOfAttributes.atmName) && + Objects.equals(this.atmLocation, atmTransactionAllOfAttributes.atmLocation) && + Objects.equals(this.surcharge, atmTransactionAllOfAttributes.surcharge) && + Objects.equals(this.tags, atmTransactionAllOfAttributes.tags) && + Objects.equals(this.networkTransactionId, atmTransactionAllOfAttributes.networkTransactionId) && + Objects.equals(this.interchange, atmTransactionAllOfAttributes.interchange) && + Objects.equals(this.internationalServiceFee, atmTransactionAllOfAttributes.internationalServiceFee) && + Objects.equals(this.cardNetwork, atmTransactionAllOfAttributes.cardNetwork); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, cardLast4Digits, atmName, atmLocation, surcharge, tags, networkTransactionId, interchange, internationalServiceFee, cardNetwork); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AtmTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" cardLast4Digits: ").append(toIndentedString(cardLast4Digits)).append("\n"); + sb.append(" atmName: ").append(toIndentedString(atmName)).append("\n"); + sb.append(" atmLocation: ").append(toIndentedString(atmLocation)).append("\n"); + sb.append(" surcharge: ").append(toIndentedString(surcharge)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" networkTransactionId: ").append(toIndentedString(networkTransactionId)).append("\n"); + sb.append(" interchange: ").append(toIndentedString(interchange)).append("\n"); + sb.append(" internationalServiceFee: ").append(toIndentedString(internationalServiceFee)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("cardLast4Digits"); + openapiFields.add("atmName"); + openapiFields.add("atmLocation"); + openapiFields.add("surcharge"); + openapiFields.add("tags"); + openapiFields.add("networkTransactionId"); + openapiFields.add("interchange"); + openapiFields.add("internationalServiceFee"); + openapiFields.add("cardNetwork"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("cardLast4Digits"); + openapiRequiredFields.add("atmName"); + openapiRequiredFields.add("surcharge"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AtmTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AtmTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AtmTransactionAllOfAttributes is not found in the empty JSON string", AtmTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AtmTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AtmTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AtmTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("cardLast4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardLast4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardLast4Digits").toString())); + } + if (!jsonObj.get("atmName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `atmName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("atmName").toString())); + } + if ((jsonObj.get("atmLocation") != null && !jsonObj.get("atmLocation").isJsonNull()) && !jsonObj.get("atmLocation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `atmLocation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("atmLocation").toString())); + } + if ((jsonObj.get("networkTransactionId") != null && !jsonObj.get("networkTransactionId").isJsonNull()) && !jsonObj.get("networkTransactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `networkTransactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("networkTransactionId").toString())); + } + if ((jsonObj.get("interchange") != null && !jsonObj.get("interchange").isJsonNull()) && !jsonObj.get("interchange").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `interchange` to be a primitive type in the JSON string but got `%s`", jsonObj.get("interchange").toString())); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AtmTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AtmTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AtmTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AtmTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AtmTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AtmTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AtmTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AtmTransactionAllOfAttributes + */ + public static AtmTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AtmTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of AtmTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Authorization.java b/src/main/java/org/openapitools/client/model/Authorization.java new file mode 100644 index 00000000..e4be009e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Authorization.java @@ -0,0 +1,310 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Authorization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Authorization { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "authorization"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private AuthorizationAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private Object relationships; + + public Authorization() { + } + + public Authorization type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Authorization id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Authorization attributes(AuthorizationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public AuthorizationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(AuthorizationAttributes attributes) { + this.attributes = attributes; + } + + + public Authorization relationships(Object relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public Object getRelationships() { + return relationships; + } + + + public void setRelationships(Object relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Authorization authorization = (Authorization) o; + return Objects.equals(this.type, authorization.type) && + Objects.equals(this.id, authorization.id) && + Objects.equals(this.attributes, authorization.attributes) && + Objects.equals(this.relationships, authorization.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Authorization {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Authorization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Authorization.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Authorization is not found in the empty JSON string", Authorization.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Authorization.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Authorization` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Authorization.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + AuthorizationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Authorization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Authorization' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Authorization.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Authorization value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Authorization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Authorization given an JSON string + * + * @param jsonString JSON string + * @return An instance of Authorization + * @throws IOException if the JSON string is invalid with respect to Authorization + */ + public static Authorization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Authorization.class); + } + + /** + * Convert an instance of Authorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationAttributes.java b/src/main/java/org/openapitools/client/model/AuthorizationAttributes.java new file mode 100644 index 00000000..36efd6c6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationAttributes.java @@ -0,0 +1,612 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.CardVerificationData; +import org.openapitools.client.model.Merchant; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_CARD_LAST4_DIGITS = "cardLast4Digits"; + @SerializedName(SERIALIZED_NAME_CARD_LAST4_DIGITS) + private String cardLast4Digits; + + public static final String SERIALIZED_NAME_MERCHANT = "merchant"; + @SerializedName(SERIALIZED_NAME_MERCHANT) + private Merchant merchant; + + public static final String SERIALIZED_NAME_RECURRING = "recurring"; + @SerializedName(SERIALIZED_NAME_RECURRING) + private Boolean recurring; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_DECLINE_REASON = "declineReason"; + @SerializedName(SERIALIZED_NAME_DECLINE_REASON) + private String declineReason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod"; + @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD) + private String paymentMethod; + + public static final String SERIALIZED_NAME_DIGITAL_WALLET = "digitalWallet"; + @SerializedName(SERIALIZED_NAME_DIGITAL_WALLET) + private String digitalWallet; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_CARD_VERIFICATION_DATA = "cardVerificationData"; + @SerializedName(SERIALIZED_NAME_CARD_VERIFICATION_DATA) + private CardVerificationData cardVerificationData; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public static final String SERIALIZED_NAME_CASH_WITHDRAWAL_AMOUNT = "cashWithdrawalAmount"; + @SerializedName(SERIALIZED_NAME_CASH_WITHDRAWAL_AMOUNT) + private Integer cashWithdrawalAmount; + + public AuthorizationAttributes() { + } + + public AuthorizationAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AuthorizationAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public AuthorizationAttributes cardLast4Digits(String cardLast4Digits) { + + this.cardLast4Digits = cardLast4Digits; + return this; + } + + /** + * Get cardLast4Digits + * @return cardLast4Digits + **/ + @javax.annotation.Nonnull + public String getCardLast4Digits() { + return cardLast4Digits; + } + + + public void setCardLast4Digits(String cardLast4Digits) { + this.cardLast4Digits = cardLast4Digits; + } + + + public AuthorizationAttributes merchant(Merchant merchant) { + + this.merchant = merchant; + return this; + } + + /** + * Get merchant + * @return merchant + **/ + @javax.annotation.Nonnull + public Merchant getMerchant() { + return merchant; + } + + + public void setMerchant(Merchant merchant) { + this.merchant = merchant; + } + + + public AuthorizationAttributes recurring(Boolean recurring) { + + this.recurring = recurring; + return this; + } + + /** + * Get recurring + * @return recurring + **/ + @javax.annotation.Nonnull + public Boolean getRecurring() { + return recurring; + } + + + public void setRecurring(Boolean recurring) { + this.recurring = recurring; + } + + + public AuthorizationAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public AuthorizationAttributes declineReason(String declineReason) { + + this.declineReason = declineReason; + return this; + } + + /** + * Get declineReason + * @return declineReason + **/ + @javax.annotation.Nullable + public String getDeclineReason() { + return declineReason; + } + + + public void setDeclineReason(String declineReason) { + this.declineReason = declineReason; + } + + + public AuthorizationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public AuthorizationAttributes paymentMethod(String paymentMethod) { + + this.paymentMethod = paymentMethod; + return this; + } + + /** + * Get paymentMethod + * @return paymentMethod + **/ + @javax.annotation.Nullable + public String getPaymentMethod() { + return paymentMethod; + } + + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + + public AuthorizationAttributes digitalWallet(String digitalWallet) { + + this.digitalWallet = digitalWallet; + return this; + } + + /** + * Get digitalWallet + * @return digitalWallet + **/ + @javax.annotation.Nullable + public String getDigitalWallet() { + return digitalWallet; + } + + + public void setDigitalWallet(String digitalWallet) { + this.digitalWallet = digitalWallet; + } + + + public AuthorizationAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nullable + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public AuthorizationAttributes cardVerificationData(CardVerificationData cardVerificationData) { + + this.cardVerificationData = cardVerificationData; + return this; + } + + /** + * Get cardVerificationData + * @return cardVerificationData + **/ + @javax.annotation.Nullable + public CardVerificationData getCardVerificationData() { + return cardVerificationData; + } + + + public void setCardVerificationData(CardVerificationData cardVerificationData) { + this.cardVerificationData = cardVerificationData; + } + + + public AuthorizationAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + public AuthorizationAttributes cashWithdrawalAmount(Integer cashWithdrawalAmount) { + + this.cashWithdrawalAmount = cashWithdrawalAmount; + return this; + } + + /** + * Get cashWithdrawalAmount + * @return cashWithdrawalAmount + **/ + @javax.annotation.Nullable + public Integer getCashWithdrawalAmount() { + return cashWithdrawalAmount; + } + + + public void setCashWithdrawalAmount(Integer cashWithdrawalAmount) { + this.cashWithdrawalAmount = cashWithdrawalAmount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationAttributes authorizationAttributes = (AuthorizationAttributes) o; + return Objects.equals(this.createdAt, authorizationAttributes.createdAt) && + Objects.equals(this.amount, authorizationAttributes.amount) && + Objects.equals(this.cardLast4Digits, authorizationAttributes.cardLast4Digits) && + Objects.equals(this.merchant, authorizationAttributes.merchant) && + Objects.equals(this.recurring, authorizationAttributes.recurring) && + Objects.equals(this.status, authorizationAttributes.status) && + Objects.equals(this.declineReason, authorizationAttributes.declineReason) && + Objects.equals(this.tags, authorizationAttributes.tags) && + Objects.equals(this.paymentMethod, authorizationAttributes.paymentMethod) && + Objects.equals(this.digitalWallet, authorizationAttributes.digitalWallet) && + Objects.equals(this.summary, authorizationAttributes.summary) && + Objects.equals(this.cardVerificationData, authorizationAttributes.cardVerificationData) && + Objects.equals(this.cardNetwork, authorizationAttributes.cardNetwork) && + Objects.equals(this.cashWithdrawalAmount, authorizationAttributes.cashWithdrawalAmount); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, cardLast4Digits, merchant, recurring, status, declineReason, tags, paymentMethod, digitalWallet, summary, cardVerificationData, cardNetwork, cashWithdrawalAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" cardLast4Digits: ").append(toIndentedString(cardLast4Digits)).append("\n"); + sb.append(" merchant: ").append(toIndentedString(merchant)).append("\n"); + sb.append(" recurring: ").append(toIndentedString(recurring)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" declineReason: ").append(toIndentedString(declineReason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); + sb.append(" digitalWallet: ").append(toIndentedString(digitalWallet)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" cardVerificationData: ").append(toIndentedString(cardVerificationData)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append(" cashWithdrawalAmount: ").append(toIndentedString(cashWithdrawalAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("cardLast4Digits"); + openapiFields.add("merchant"); + openapiFields.add("recurring"); + openapiFields.add("status"); + openapiFields.add("declineReason"); + openapiFields.add("tags"); + openapiFields.add("paymentMethod"); + openapiFields.add("digitalWallet"); + openapiFields.add("summary"); + openapiFields.add("cardVerificationData"); + openapiFields.add("cardNetwork"); + openapiFields.add("cashWithdrawalAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("cardLast4Digits"); + openapiRequiredFields.add("merchant"); + openapiRequiredFields.add("recurring"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationAttributes is not found in the empty JSON string", AuthorizationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("cardLast4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardLast4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardLast4Digits").toString())); + } + // validate the required field `merchant` + Merchant.validateJsonElement(jsonObj.get("merchant")); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("declineReason") != null && !jsonObj.get("declineReason").isJsonNull()) && !jsonObj.get("declineReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `declineReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("declineReason").toString())); + } + if ((jsonObj.get("paymentMethod") != null && !jsonObj.get("paymentMethod").isJsonNull()) && !jsonObj.get("paymentMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethod").toString())); + } + if ((jsonObj.get("digitalWallet") != null && !jsonObj.get("digitalWallet").isJsonNull()) && !jsonObj.get("digitalWallet").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digitalWallet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digitalWallet").toString())); + } + if ((jsonObj.get("summary") != null && !jsonObj.get("summary").isJsonNull()) && !jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + // validate the optional field `cardVerificationData` + if (jsonObj.get("cardVerificationData") != null && !jsonObj.get("cardVerificationData").isJsonNull()) { + CardVerificationData.validateJsonElement(jsonObj.get("cardVerificationData")); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationAttributes + * @throws IOException if the JSON string is invalid with respect to AuthorizationAttributes + */ + public static AuthorizationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationAttributes.class); + } + + /** + * Convert an instance of AuthorizationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRelationship.java b/src/main/java/org/openapitools/client/model/AuthorizationRelationship.java new file mode 100644 index 00000000..a38584b7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AuthorizationRelationshipData data; + + public AuthorizationRelationship() { + } + + public AuthorizationRelationship data(AuthorizationRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AuthorizationRelationshipData getData() { + return data; + } + + + public void setData(AuthorizationRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRelationship authorizationRelationship = (AuthorizationRelationship) o; + return Objects.equals(this.data, authorizationRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRelationship is not found in the empty JSON string", AuthorizationRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AuthorizationRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRelationship + * @throws IOException if the JSON string is invalid with respect to AuthorizationRelationship + */ + public static AuthorizationRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRelationship.class); + } + + /** + * Convert an instance of AuthorizationRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRelationshipData.java b/src/main/java/org/openapitools/client/model/AuthorizationRelationshipData.java new file mode 100644 index 00000000..d7cb89e1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "authorization"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AuthorizationRelationshipData() { + } + + public AuthorizationRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AuthorizationRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRelationshipData authorizationRelationshipData = (AuthorizationRelationshipData) o; + return Objects.equals(this.type, authorizationRelationshipData.type) && + Objects.equals(this.id, authorizationRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRelationshipData is not found in the empty JSON string", AuthorizationRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRelationshipData + * @throws IOException if the JSON string is invalid with respect to AuthorizationRelationshipData + */ + public static AuthorizationRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRelationshipData.class); + } + + /** + * Convert an instance of AuthorizationRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRequest.java b/src/main/java/org/openapitools/client/model/AuthorizationRequest.java new file mode 100644 index 00000000..76d63bcc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRequest.java @@ -0,0 +1,212 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AuthorizationRequest() { + this.type = this.getClass().getSimpleName(); + } + + public AuthorizationRequest type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AuthorizationRequest id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRequest authorizationRequest = (AuthorizationRequest) o; + return Objects.equals(this.type, authorizationRequest.type) && + Objects.equals(this.id, authorizationRequest.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRequest is not found in the empty JSON string", AuthorizationRequest.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "atmAuthorizationRequest": + AtmAuthorizationRequest.validateJsonElement(jsonElement); + break; + case "cardTransactionAuthorizationRequest": + CardTransactionAuthorizationRequest.validateJsonElement(jsonElement); + break; + case "purchaseAuthorizationRequest": + PurchaseAuthorizationRequest.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of AuthorizationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRequest + * @throws IOException if the JSON string is invalid with respect to AuthorizationRequest + */ + public static AuthorizationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRequest.class); + } + + /** + * Convert an instance of AuthorizationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationship.java b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationship.java new file mode 100644 index 00000000..9bce0f16 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequestRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRequestRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRequestRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AuthorizationRequestRelationshipData data; + + public AuthorizationRequestRelationship() { + } + + public AuthorizationRequestRelationship data(AuthorizationRequestRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationshipData getData() { + return data; + } + + + public void setData(AuthorizationRequestRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRequestRelationship authorizationRequestRelationship = (AuthorizationRequestRelationship) o; + return Objects.equals(this.data, authorizationRequestRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRequestRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRequestRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRequestRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRequestRelationship is not found in the empty JSON string", AuthorizationRequestRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRequestRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRequestRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRequestRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AuthorizationRequestRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRequestRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRequestRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRequestRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRequestRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRequestRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRequestRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRequestRelationship + * @throws IOException if the JSON string is invalid with respect to AuthorizationRequestRelationship + */ + public static AuthorizationRequestRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRequestRelationship.class); + } + + /** + * Convert an instance of AuthorizationRequestRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipData.java b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipData.java new file mode 100644 index 00000000..257d837a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRequestRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRequestRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "authorizationRequest"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AuthorizationRequestRelationshipData() { + } + + public AuthorizationRequestRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AuthorizationRequestRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRequestRelationshipData authorizationRequestRelationshipData = (AuthorizationRequestRelationshipData) o; + return Objects.equals(this.type, authorizationRequestRelationshipData.type) && + Objects.equals(this.id, authorizationRequestRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRequestRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRequestRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRequestRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRequestRelationshipData is not found in the empty JSON string", AuthorizationRequestRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRequestRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRequestRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRequestRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRequestRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRequestRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRequestRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRequestRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRequestRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRequestRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRequestRelationshipData + * @throws IOException if the JSON string is invalid with respect to AuthorizationRequestRelationshipData + */ + public static AuthorizationRequestRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRequestRelationshipData.class); + } + + /** + * Convert an instance of AuthorizationRequestRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationships.java b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationships.java new file mode 100644 index 00000000..ac6846ba --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationships.java @@ -0,0 +1,312 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequestRelationshipsCard; +import org.openapitools.client.model.RelationshipsAccount; +import org.openapitools.client.model.RelationshipsCustomer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRequestRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRequestRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private RelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RelationshipsAccount account; + + public static final String SERIALIZED_NAME_FUNDING_ACCOUNT = "fundingAccount"; + @SerializedName(SERIALIZED_NAME_FUNDING_ACCOUNT) + private RelationshipsAccount fundingAccount; + + public static final String SERIALIZED_NAME_CARD = "card"; + @SerializedName(SERIALIZED_NAME_CARD) + private AuthorizationRequestRelationshipsCard card; + + public AuthorizationRequestRelationships() { + } + + public AuthorizationRequestRelationships customer(RelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public RelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(RelationshipsCustomer customer) { + this.customer = customer; + } + + + public AuthorizationRequestRelationships account(RelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public RelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RelationshipsAccount account) { + this.account = account; + } + + + public AuthorizationRequestRelationships fundingAccount(RelationshipsAccount fundingAccount) { + + this.fundingAccount = fundingAccount; + return this; + } + + /** + * Get fundingAccount + * @return fundingAccount + **/ + @javax.annotation.Nullable + public RelationshipsAccount getFundingAccount() { + return fundingAccount; + } + + + public void setFundingAccount(RelationshipsAccount fundingAccount) { + this.fundingAccount = fundingAccount; + } + + + public AuthorizationRequestRelationships card(AuthorizationRequestRelationshipsCard card) { + + this.card = card; + return this; + } + + /** + * Get card + * @return card + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationshipsCard getCard() { + return card; + } + + + public void setCard(AuthorizationRequestRelationshipsCard card) { + this.card = card; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRequestRelationships authorizationRequestRelationships = (AuthorizationRequestRelationships) o; + return Objects.equals(this.customer, authorizationRequestRelationships.customer) && + Objects.equals(this.account, authorizationRequestRelationships.account) && + Objects.equals(this.fundingAccount, authorizationRequestRelationships.fundingAccount) && + Objects.equals(this.card, authorizationRequestRelationships.card); + } + + @Override + public int hashCode() { + return Objects.hash(customer, account, fundingAccount, card); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRequestRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" fundingAccount: ").append(toIndentedString(fundingAccount)).append("\n"); + sb.append(" card: ").append(toIndentedString(card)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + openapiFields.add("account"); + openapiFields.add("fundingAccount"); + openapiFields.add("card"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("customer"); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("card"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRequestRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRequestRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRequestRelationships is not found in the empty JSON string", AuthorizationRequestRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRequestRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRequestRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRequestRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `customer` + RelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + // validate the required field `account` + RelationshipsAccount.validateJsonElement(jsonObj.get("account")); + // validate the optional field `fundingAccount` + if (jsonObj.get("fundingAccount") != null && !jsonObj.get("fundingAccount").isJsonNull()) { + RelationshipsAccount.validateJsonElement(jsonObj.get("fundingAccount")); + } + // validate the required field `card` + AuthorizationRequestRelationshipsCard.validateJsonElement(jsonObj.get("card")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRequestRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRequestRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRequestRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRequestRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRequestRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRequestRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRequestRelationships + * @throws IOException if the JSON string is invalid with respect to AuthorizationRequestRelationships + */ + public static AuthorizationRequestRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRequestRelationships.class); + } + + /** + * Convert an instance of AuthorizationRequestRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipsCard.java b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipsCard.java new file mode 100644 index 00000000..30ca5720 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipsCard.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequestRelationshipsCardData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRequestRelationshipsCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRequestRelationshipsCard { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AuthorizationRequestRelationshipsCardData data; + + public AuthorizationRequestRelationshipsCard() { + } + + public AuthorizationRequestRelationshipsCard data(AuthorizationRequestRelationshipsCardData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationshipsCardData getData() { + return data; + } + + + public void setData(AuthorizationRequestRelationshipsCardData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRequestRelationshipsCard authorizationRequestRelationshipsCard = (AuthorizationRequestRelationshipsCard) o; + return Objects.equals(this.data, authorizationRequestRelationshipsCard.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRequestRelationshipsCard {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRequestRelationshipsCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRequestRelationshipsCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRequestRelationshipsCard is not found in the empty JSON string", AuthorizationRequestRelationshipsCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRequestRelationshipsCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRequestRelationshipsCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRequestRelationshipsCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AuthorizationRequestRelationshipsCardData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRequestRelationshipsCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRequestRelationshipsCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRequestRelationshipsCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRequestRelationshipsCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRequestRelationshipsCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRequestRelationshipsCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRequestRelationshipsCard + * @throws IOException if the JSON string is invalid with respect to AuthorizationRequestRelationshipsCard + */ + public static AuthorizationRequestRelationshipsCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRequestRelationshipsCard.class); + } + + /** + * Convert an instance of AuthorizationRequestRelationshipsCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipsCardData.java b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipsCardData.java new file mode 100644 index 00000000..1c5fcbcf --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizationRequestRelationshipsCardData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizationRequestRelationshipsCardData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizationRequestRelationshipsCardData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "card"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public AuthorizationRequestRelationshipsCardData() { + } + + public AuthorizationRequestRelationshipsCardData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AuthorizationRequestRelationshipsCardData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationRequestRelationshipsCardData authorizationRequestRelationshipsCardData = (AuthorizationRequestRelationshipsCardData) o; + return Objects.equals(this.type, authorizationRequestRelationshipsCardData.type) && + Objects.equals(this.id, authorizationRequestRelationshipsCardData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationRequestRelationshipsCardData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizationRequestRelationshipsCardData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizationRequestRelationshipsCardData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizationRequestRelationshipsCardData is not found in the empty JSON string", AuthorizationRequestRelationshipsCardData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizationRequestRelationshipsCardData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationRequestRelationshipsCardData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizationRequestRelationshipsCardData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizationRequestRelationshipsCardData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizationRequestRelationshipsCardData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizationRequestRelationshipsCardData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizationRequestRelationshipsCardData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizationRequestRelationshipsCardData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizationRequestRelationshipsCardData given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizationRequestRelationshipsCardData + * @throws IOException if the JSON string is invalid with respect to AuthorizationRequestRelationshipsCardData + */ + public static AuthorizationRequestRelationshipsCardData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizationRequestRelationshipsCardData.class); + } + + /** + * Convert an instance of AuthorizationRequestRelationshipsCardData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/AuthorizedUser.java b/src/main/java/org/openapitools/client/model/AuthorizedUser.java new file mode 100644 index 00000000..4725dbc3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/AuthorizedUser.java @@ -0,0 +1,323 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AuthorizedUser + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AuthorizedUser { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public AuthorizedUser() { + } + + public AuthorizedUser fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public AuthorizedUser email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public AuthorizedUser phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public AuthorizedUser jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizedUser authorizedUser = (AuthorizedUser) o; + return Objects.equals(this.fullName, authorizedUser.fullName) && + Objects.equals(this.email, authorizedUser.email) && + Objects.equals(this.phone, authorizedUser.phone) && + Objects.equals(this.jwtSubject, authorizedUser.jwtSubject); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, jwtSubject); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizedUser {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("jwtSubject"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthorizedUser + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthorizedUser.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizedUser is not found in the empty JSON string", AuthorizedUser.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthorizedUser.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizedUser` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthorizedUser.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizedUser.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizedUser' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizedUser.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthorizedUser value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthorizedUser read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthorizedUser given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthorizedUser + * @throws IOException if the JSON string is invalid with respect to AuthorizedUser + */ + public static AuthorizedUser fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthorizedUser.class); + } + + /** + * Convert an instance of AuthorizedUser to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BIN.java b/src/main/java/org/openapitools/client/model/BIN.java new file mode 100644 index 00000000..026cc77b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BIN.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BIN + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BIN { + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private String bin; + + public static final String SERIALIZED_NAME_INSTITUTION_ID = "institutionId"; + @SerializedName(SERIALIZED_NAME_INSTITUTION_ID) + private String institutionId; + + public BIN() { + } + + public BIN bin(String bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nonnull + public String getBin() { + return bin; + } + + + public void setBin(String bin) { + this.bin = bin; + } + + + public BIN institutionId(String institutionId) { + + this.institutionId = institutionId; + return this; + } + + /** + * Get institutionId + * @return institutionId + **/ + @javax.annotation.Nonnull + public String getInstitutionId() { + return institutionId; + } + + + public void setInstitutionId(String institutionId) { + this.institutionId = institutionId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BIN BIN = (BIN) o; + return Objects.equals(this.bin, BIN.bin) && + Objects.equals(this.institutionId, BIN.institutionId); + } + + @Override + public int hashCode() { + return Objects.hash(bin, institutionId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BIN {\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" institutionId: ").append(toIndentedString(institutionId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bin"); + openapiFields.add("institutionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("bin"); + openapiRequiredFields.add("institutionId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BIN + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BIN.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BIN is not found in the empty JSON string", BIN.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BIN.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BIN` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BIN.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("bin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bin").toString())); + } + if (!jsonObj.get("institutionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `institutionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("institutionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BIN.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BIN' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BIN.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BIN value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BIN read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BIN given an JSON string + * + * @param jsonString JSON string + * @return An instance of BIN + * @throws IOException if the JSON string is invalid with respect to BIN + */ + public static BIN fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BIN.class); + } + + /** + * Convert an instance of BIN to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BankRepaymentTransaction.java b/src/main/java/org/openapitools/client/model/BankRepaymentTransaction.java new file mode 100644 index 00000000..dd44b089 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BankRepaymentTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BankRepaymentTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BankRepaymentTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BankRepaymentTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BankRepaymentTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public BankRepaymentTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public BankRepaymentTransaction attributes(BankRepaymentTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BankRepaymentTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BankRepaymentTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BankRepaymentTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BankRepaymentTransaction bankRepaymentTransaction = (BankRepaymentTransaction) o; + return Objects.equals(this.attributes, bankRepaymentTransaction.attributes) && + Objects.equals(this.relationships, bankRepaymentTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BankRepaymentTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BankRepaymentTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BankRepaymentTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BankRepaymentTransaction is not found in the empty JSON string", BankRepaymentTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BankRepaymentTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BankRepaymentTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BankRepaymentTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BankRepaymentTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BankRepaymentTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BankRepaymentTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BankRepaymentTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BankRepaymentTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BankRepaymentTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of BankRepaymentTransaction + * @throws IOException if the JSON string is invalid with respect to BankRepaymentTransaction + */ + public static BankRepaymentTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BankRepaymentTransaction.class); + } + + /** + * Convert an instance of BankRepaymentTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BankRepaymentTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BankRepaymentTransactionAllOfAttributes.java new file mode 100644 index 00000000..6b085396 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BankRepaymentTransactionAllOfAttributes.java @@ -0,0 +1,443 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BankRepaymentTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BankRepaymentTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_PAID_FOR_DATE = "paidForDate"; + @SerializedName(SERIALIZED_NAME_PAID_FOR_DATE) + private String paidForDate; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public BankRepaymentTransactionAllOfAttributes() { + } + + public BankRepaymentTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BankRepaymentTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public BankRepaymentTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public BankRepaymentTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public BankRepaymentTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public BankRepaymentTransactionAllOfAttributes paidForDate(String paidForDate) { + + this.paidForDate = paidForDate; + return this; + } + + /** + * Get paidForDate + * @return paidForDate + **/ + @javax.annotation.Nonnull + public String getPaidForDate() { + return paidForDate; + } + + + public void setPaidForDate(String paidForDate) { + this.paidForDate = paidForDate; + } + + + public BankRepaymentTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BankRepaymentTransactionAllOfAttributes bankRepaymentTransactionAllOfAttributes = (BankRepaymentTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, bankRepaymentTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, bankRepaymentTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, bankRepaymentTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, bankRepaymentTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, bankRepaymentTransactionAllOfAttributes.summary) && + Objects.equals(this.paidForDate, bankRepaymentTransactionAllOfAttributes.paidForDate) && + Objects.equals(this.tags, bankRepaymentTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, paidForDate, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BankRepaymentTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" paidForDate: ").append(toIndentedString(paidForDate)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("paidForDate"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("paidForDate"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BankRepaymentTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BankRepaymentTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BankRepaymentTransactionAllOfAttributes is not found in the empty JSON string", BankRepaymentTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BankRepaymentTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BankRepaymentTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BankRepaymentTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("paidForDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paidForDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paidForDate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BankRepaymentTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BankRepaymentTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BankRepaymentTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BankRepaymentTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BankRepaymentTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BankRepaymentTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BankRepaymentTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BankRepaymentTransactionAllOfAttributes + */ + public static BankRepaymentTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BankRepaymentTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of BankRepaymentTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BeneficialOwner.java b/src/main/java/org/openapitools/client/model/BeneficialOwner.java new file mode 100644 index 00000000..8868c285 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BeneficialOwner.java @@ -0,0 +1,450 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.SourceOfIncome; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BeneficialOwner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BeneficialOwner { + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public BeneficialOwner() { + } + + public BeneficialOwner ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public BeneficialOwner passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public BeneficialOwner nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public BeneficialOwner matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public BeneficialOwner address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public BeneficialOwner dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public BeneficialOwner occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public BeneficialOwner annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public BeneficialOwner sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BeneficialOwner beneficialOwner = (BeneficialOwner) o; + return Objects.equals(this.ssn, beneficialOwner.ssn) && + Objects.equals(this.passport, beneficialOwner.passport) && + Objects.equals(this.nationality, beneficialOwner.nationality) && + Objects.equals(this.matriculaConsular, beneficialOwner.matriculaConsular) && + Objects.equals(this.address, beneficialOwner.address) && + Objects.equals(this.dateOfBirth, beneficialOwner.dateOfBirth) && + Objects.equals(this.occupation, beneficialOwner.occupation) && + Objects.equals(this.annualIncome, beneficialOwner.annualIncome) && + Objects.equals(this.sourceOfIncome, beneficialOwner.sourceOfIncome); + } + + @Override + public int hashCode() { + return Objects.hash(ssn, passport, nationality, matriculaConsular, address, dateOfBirth, occupation, annualIncome, sourceOfIncome); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BeneficialOwner {\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BeneficialOwner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BeneficialOwner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BeneficialOwner is not found in the empty JSON string", BeneficialOwner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BeneficialOwner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BeneficialOwner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BeneficialOwner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BeneficialOwner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BeneficialOwner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BeneficialOwner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BeneficialOwner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BeneficialOwner given an JSON string + * + * @param jsonString JSON string + * @return An instance of BeneficialOwner + * @throws IOException if the JSON string is invalid with respect to BeneficialOwner + */ + public static BeneficialOwner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BeneficialOwner.class); + } + + /** + * Convert an instance of BeneficialOwner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BeneficialOwner1.java b/src/main/java/org/openapitools/client/model/BeneficialOwner1.java new file mode 100644 index 00000000..97255e55 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BeneficialOwner1.java @@ -0,0 +1,837 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.SourceOfIncome; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BeneficialOwner1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BeneficialOwner1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Object address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + private Integer percentage; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_MASKED_S_S_N = "maskedSSN"; + @SerializedName(SERIALIZED_NAME_MASKED_S_S_N) + private String maskedSSN; + + public static final String SERIALIZED_NAME_MASKED_PASSPORT = "maskedPassport"; + @SerializedName(SERIALIZED_NAME_MASKED_PASSPORT) + private String maskedPassport; + + public static final String SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR = "maskedMatriculaConsular"; + @SerializedName(SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR) + private String maskedMatriculaConsular; + + public static final String SERIALIZED_NAME_ID_THEFT_SCORE = "idTheftScore"; + @SerializedName(SERIALIZED_NAME_ID_THEFT_SCORE) + private Integer idTheftScore; + + public static final String SERIALIZED_NAME_EVALUATION_CODES = "evaluationCodes"; + @SerializedName(SERIALIZED_NAME_EVALUATION_CODES) + private List evaluationCodes; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public BeneficialOwner1() { + } + + public BeneficialOwner1 status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public BeneficialOwner1 fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public BeneficialOwner1 email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public BeneficialOwner1 phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public BeneficialOwner1 ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public BeneficialOwner1 passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public BeneficialOwner1 nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public BeneficialOwner1 matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public BeneficialOwner1 address(Object address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Object getAddress() { + return address; + } + + + public void setAddress(Object address) { + this.address = address; + } + + + public BeneficialOwner1 dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public BeneficialOwner1 evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public BeneficialOwner1 percentage(Integer percentage) { + + this.percentage = percentage; + return this; + } + + /** + * Get percentage + * minimum: 0 + * maximum: 100 + * @return percentage + **/ + @javax.annotation.Nullable + public Integer getPercentage() { + return percentage; + } + + + public void setPercentage(Integer percentage) { + this.percentage = percentage; + } + + + public BeneficialOwner1 evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public BeneficialOwner1 addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public BeneficialOwner1 maskedSSN(String maskedSSN) { + + this.maskedSSN = maskedSSN; + return this; + } + + /** + * Get maskedSSN + * @return maskedSSN + **/ + @javax.annotation.Nullable + public String getMaskedSSN() { + return maskedSSN; + } + + + public void setMaskedSSN(String maskedSSN) { + this.maskedSSN = maskedSSN; + } + + + public BeneficialOwner1 maskedPassport(String maskedPassport) { + + this.maskedPassport = maskedPassport; + return this; + } + + /** + * Get maskedPassport + * @return maskedPassport + **/ + @javax.annotation.Nullable + public String getMaskedPassport() { + return maskedPassport; + } + + + public void setMaskedPassport(String maskedPassport) { + this.maskedPassport = maskedPassport; + } + + + public BeneficialOwner1 maskedMatriculaConsular(String maskedMatriculaConsular) { + + this.maskedMatriculaConsular = maskedMatriculaConsular; + return this; + } + + /** + * Get maskedMatriculaConsular + * @return maskedMatriculaConsular + **/ + @javax.annotation.Nullable + public String getMaskedMatriculaConsular() { + return maskedMatriculaConsular; + } + + + public void setMaskedMatriculaConsular(String maskedMatriculaConsular) { + this.maskedMatriculaConsular = maskedMatriculaConsular; + } + + + public BeneficialOwner1 idTheftScore(Integer idTheftScore) { + + this.idTheftScore = idTheftScore; + return this; + } + + /** + * Get idTheftScore + * @return idTheftScore + **/ + @javax.annotation.Nullable + public Integer getIdTheftScore() { + return idTheftScore; + } + + + public void setIdTheftScore(Integer idTheftScore) { + this.idTheftScore = idTheftScore; + } + + + public BeneficialOwner1 evaluationCodes(List evaluationCodes) { + + this.evaluationCodes = evaluationCodes; + return this; + } + + public BeneficialOwner1 addEvaluationCodesItem(String evaluationCodesItem) { + if (this.evaluationCodes == null) { + this.evaluationCodes = new ArrayList<>(); + } + this.evaluationCodes.add(evaluationCodesItem); + return this; + } + + /** + * Get evaluationCodes + * @return evaluationCodes + **/ + @javax.annotation.Nullable + public List getEvaluationCodes() { + return evaluationCodes; + } + + + public void setEvaluationCodes(List evaluationCodes) { + this.evaluationCodes = evaluationCodes; + } + + + public BeneficialOwner1 occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public BeneficialOwner1 annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public BeneficialOwner1 sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BeneficialOwner1 beneficialOwner1 = (BeneficialOwner1) o; + return Objects.equals(this.status, beneficialOwner1.status) && + Objects.equals(this.fullName, beneficialOwner1.fullName) && + Objects.equals(this.email, beneficialOwner1.email) && + Objects.equals(this.phone, beneficialOwner1.phone) && + Objects.equals(this.ssn, beneficialOwner1.ssn) && + Objects.equals(this.passport, beneficialOwner1.passport) && + Objects.equals(this.nationality, beneficialOwner1.nationality) && + Objects.equals(this.matriculaConsular, beneficialOwner1.matriculaConsular) && + Objects.equals(this.address, beneficialOwner1.address) && + Objects.equals(this.dateOfBirth, beneficialOwner1.dateOfBirth) && + Objects.equals(this.evaluationId, beneficialOwner1.evaluationId) && + Objects.equals(this.percentage, beneficialOwner1.percentage) && + Objects.equals(this.evaluationFlags, beneficialOwner1.evaluationFlags) && + Objects.equals(this.maskedSSN, beneficialOwner1.maskedSSN) && + Objects.equals(this.maskedPassport, beneficialOwner1.maskedPassport) && + Objects.equals(this.maskedMatriculaConsular, beneficialOwner1.maskedMatriculaConsular) && + Objects.equals(this.idTheftScore, beneficialOwner1.idTheftScore) && + Objects.equals(this.evaluationCodes, beneficialOwner1.evaluationCodes) && + Objects.equals(this.occupation, beneficialOwner1.occupation) && + Objects.equals(this.annualIncome, beneficialOwner1.annualIncome) && + Objects.equals(this.sourceOfIncome, beneficialOwner1.sourceOfIncome); + } + + @Override + public int hashCode() { + return Objects.hash(status, fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, evaluationId, percentage, evaluationFlags, maskedSSN, maskedPassport, maskedMatriculaConsular, idTheftScore, evaluationCodes, occupation, annualIncome, sourceOfIncome); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BeneficialOwner1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" maskedSSN: ").append(toIndentedString(maskedSSN)).append("\n"); + sb.append(" maskedPassport: ").append(toIndentedString(maskedPassport)).append("\n"); + sb.append(" maskedMatriculaConsular: ").append(toIndentedString(maskedMatriculaConsular)).append("\n"); + sb.append(" idTheftScore: ").append(toIndentedString(idTheftScore)).append("\n"); + sb.append(" evaluationCodes: ").append(toIndentedString(evaluationCodes)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("evaluationId"); + openapiFields.add("percentage"); + openapiFields.add("evaluationFlags"); + openapiFields.add("maskedSSN"); + openapiFields.add("maskedPassport"); + openapiFields.add("maskedMatriculaConsular"); + openapiFields.add("idTheftScore"); + openapiFields.add("evaluationCodes"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BeneficialOwner1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BeneficialOwner1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BeneficialOwner1 is not found in the empty JSON string", BeneficialOwner1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BeneficialOwner1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BeneficialOwner1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + if ((jsonObj.get("maskedSSN") != null && !jsonObj.get("maskedSSN").isJsonNull()) && !jsonObj.get("maskedSSN").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedSSN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedSSN").toString())); + } + if ((jsonObj.get("maskedPassport") != null && !jsonObj.get("maskedPassport").isJsonNull()) && !jsonObj.get("maskedPassport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedPassport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedPassport").toString())); + } + if ((jsonObj.get("maskedMatriculaConsular") != null && !jsonObj.get("maskedMatriculaConsular").isJsonNull()) && !jsonObj.get("maskedMatriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedMatriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedMatriculaConsular").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationCodes") != null && !jsonObj.get("evaluationCodes").isJsonNull() && !jsonObj.get("evaluationCodes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationCodes` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationCodes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BeneficialOwner1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BeneficialOwner1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BeneficialOwner1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BeneficialOwner1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BeneficialOwner1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BeneficialOwner1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of BeneficialOwner1 + * @throws IOException if the JSON string is invalid with respect to BeneficialOwner1 + */ + public static BeneficialOwner1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BeneficialOwner1.class); + } + + /** + * Convert an instance of BeneficialOwner1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Beneficiary.java b/src/main/java/org/openapitools/client/model/Beneficiary.java new file mode 100644 index 00000000..8b53a295 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Beneficiary.java @@ -0,0 +1,246 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.FullName; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Beneficiary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Beneficiary { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public Beneficiary() { + } + + public Beneficiary fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Beneficiary dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Beneficiary beneficiary = (Beneficiary) o; + return Objects.equals(this.fullName, beneficiary.fullName) && + Objects.equals(this.dateOfBirth, beneficiary.dateOfBirth); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, dateOfBirth); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Beneficiary {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("dateOfBirth"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Beneficiary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Beneficiary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Beneficiary is not found in the empty JSON string", Beneficiary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Beneficiary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Beneficiary` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Beneficiary.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Beneficiary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Beneficiary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Beneficiary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Beneficiary value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Beneficiary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Beneficiary given an JSON string + * + * @param jsonString JSON string + * @return An instance of Beneficiary + * @throws IOException if the JSON string is invalid with respect to Beneficiary + */ + public static Beneficiary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Beneficiary.class); + } + + /** + * Convert an instance of Beneficiary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BillPayTransaction.java b/src/main/java/org/openapitools/client/model/BillPayTransaction.java new file mode 100644 index 00000000..f0c6f89b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BillPayTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BillPayTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BillPayTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public BillPayTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public BillPayTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BillPayTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillPayTransaction billPayTransaction = (BillPayTransaction) o; + return Objects.equals(this.attributes, billPayTransaction.attributes) && + Objects.equals(this.relationships, billPayTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillPayTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillPayTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillPayTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillPayTransaction is not found in the empty JSON string", BillPayTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillPayTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillPayTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BillPayTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillPayTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillPayTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillPayTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillPayTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillPayTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillPayTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillPayTransaction + * @throws IOException if the JSON string is invalid with respect to BillPayTransaction + */ + public static BillPayTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillPayTransaction.class); + } + + /** + * Convert an instance of BillPayTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BillPayment.java b/src/main/java/org/openapitools/client/model/BillPayment.java new file mode 100644 index 00000000..b9353408 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BillPayment.java @@ -0,0 +1,251 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BillPaymentAllOfAttributes; +import org.openapitools.client.model.Payment; +import org.openapitools.client.model.PaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BillPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BillPayment extends Payment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BillPaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private PaymentRelationships relationships; + + public BillPayment() { + this.type = this.getClass().getSimpleName(); + } + + public BillPayment attributes(BillPaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BillPaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BillPaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BillPayment relationships(PaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public PaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(PaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillPayment billPayment = (BillPayment) o; + return Objects.equals(this.attributes, billPayment.attributes) && + Objects.equals(this.relationships, billPayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillPayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillPayment is not found in the empty JSON string", BillPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BillPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillPayment + * @throws IOException if the JSON string is invalid with respect to BillPayment + */ + public static BillPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillPayment.class); + } + + /** + * Convert an instance of BillPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BillPaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BillPaymentAllOfAttributes.java new file mode 100644 index 00000000..4397147e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BillPaymentAllOfAttributes.java @@ -0,0 +1,475 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BillPaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BillPaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + INITIALIZED("Initialized"), + + PENDING("Pending"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public BillPaymentAllOfAttributes() { + } + + public BillPaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BillPaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public BillPaymentAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public BillPaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public BillPaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public BillPaymentAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillPaymentAllOfAttributes billPaymentAllOfAttributes = (BillPaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, billPaymentAllOfAttributes.createdAt) && + Objects.equals(this.amount, billPaymentAllOfAttributes.amount) && + Objects.equals(this.direction, billPaymentAllOfAttributes.direction) && + Objects.equals(this.description, billPaymentAllOfAttributes.description) && + Objects.equals(this.status, billPaymentAllOfAttributes.status) && + Objects.equals(this.reason, billPaymentAllOfAttributes.reason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, description, status, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillPaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("description"); + openapiFields.add("status"); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillPaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillPaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillPaymentAllOfAttributes is not found in the empty JSON string", BillPaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillPaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillPaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BillPaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillPaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillPaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillPaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillPaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillPaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillPaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillPaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BillPaymentAllOfAttributes + */ + public static BillPaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillPaymentAllOfAttributes.class); + } + + /** + * Convert an instance of BillPaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookPayment.java b/src/main/java/org/openapitools/client/model/BookPayment.java new file mode 100644 index 00000000..b46f12bb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookPayment.java @@ -0,0 +1,251 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BookPaymentAllOfAttributes; +import org.openapitools.client.model.Payment; +import org.openapitools.client.model.PaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookPayment extends Payment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BookPaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private PaymentRelationships relationships; + + public BookPayment() { + this.type = this.getClass().getSimpleName(); + } + + public BookPayment attributes(BookPaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BookPaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BookPaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BookPayment relationships(PaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public PaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(PaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookPayment bookPayment = (BookPayment) o; + return Objects.equals(this.attributes, bookPayment.attributes) && + Objects.equals(this.relationships, bookPayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookPayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookPayment is not found in the empty JSON string", BookPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookPayment + * @throws IOException if the JSON string is invalid with respect to BookPayment + */ + public static BookPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookPayment.class); + } + + /** + * Convert an instance of BookPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookPaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BookPaymentAllOfAttributes.java new file mode 100644 index 00000000..0036231b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookPaymentAllOfAttributes.java @@ -0,0 +1,532 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookPaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookPaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_TRANSACTION_SUMMARY_OVERRIDE = "transactionSummaryOverride"; + @SerializedName(SERIALIZED_NAME_TRANSACTION_SUMMARY_OVERRIDE) + private String transactionSummaryOverride; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public BookPaymentAllOfAttributes() { + } + + public BookPaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BookPaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public BookPaymentAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public BookPaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public BookPaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public BookPaymentAllOfAttributes transactionSummaryOverride(String transactionSummaryOverride) { + + this.transactionSummaryOverride = transactionSummaryOverride; + return this; + } + + /** + * Get transactionSummaryOverride + * @return transactionSummaryOverride + **/ + @javax.annotation.Nullable + public String getTransactionSummaryOverride() { + return transactionSummaryOverride; + } + + + public void setTransactionSummaryOverride(String transactionSummaryOverride) { + this.transactionSummaryOverride = transactionSummaryOverride; + } + + + public BookPaymentAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public BookPaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookPaymentAllOfAttributes bookPaymentAllOfAttributes = (BookPaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, bookPaymentAllOfAttributes.createdAt) && + Objects.equals(this.amount, bookPaymentAllOfAttributes.amount) && + Objects.equals(this.direction, bookPaymentAllOfAttributes.direction) && + Objects.equals(this.description, bookPaymentAllOfAttributes.description) && + Objects.equals(this.status, bookPaymentAllOfAttributes.status) && + Objects.equals(this.transactionSummaryOverride, bookPaymentAllOfAttributes.transactionSummaryOverride) && + Objects.equals(this.reason, bookPaymentAllOfAttributes.reason) && + Objects.equals(this.tags, bookPaymentAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, description, status, transactionSummaryOverride, reason, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookPaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" transactionSummaryOverride: ").append(toIndentedString(transactionSummaryOverride)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("description"); + openapiFields.add("status"); + openapiFields.add("transactionSummaryOverride"); + openapiFields.add("reason"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookPaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookPaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookPaymentAllOfAttributes is not found in the empty JSON string", BookPaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookPaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookPaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookPaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("transactionSummaryOverride") != null && !jsonObj.get("transactionSummaryOverride").isJsonNull()) && !jsonObj.get("transactionSummaryOverride").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transactionSummaryOverride` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transactionSummaryOverride").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookPaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookPaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookPaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookPaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookPaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookPaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookPaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BookPaymentAllOfAttributes + */ + public static BookPaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookPaymentAllOfAttributes.class); + } + + /** + * Convert an instance of BookPaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookRepayment.java b/src/main/java/org/openapitools/client/model/BookRepayment.java new file mode 100644 index 00000000..4a23774c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookRepayment.java @@ -0,0 +1,240 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BookRepaymentAllOfAttributes; +import org.openapitools.client.model.BookRepaymentAllOfRelationships; +import org.openapitools.client.model.Repayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookRepayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookRepayment extends Repayment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BookRepaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private BookRepaymentAllOfRelationships relationships; + + public BookRepayment() { + this.type = this.getClass().getSimpleName(); + } + + public BookRepayment attributes(BookRepaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public BookRepaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BookRepaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BookRepayment relationships(BookRepaymentAllOfRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public BookRepaymentAllOfRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(BookRepaymentAllOfRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookRepayment bookRepayment = (BookRepayment) o; + return Objects.equals(this.attributes, bookRepayment.attributes) && + Objects.equals(this.relationships, bookRepayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookRepayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookRepayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookRepayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookRepayment is not found in the empty JSON string", BookRepayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookRepayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookRepayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookRepayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookRepayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookRepayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookRepayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookRepayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookRepayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookRepayment + * @throws IOException if the JSON string is invalid with respect to BookRepayment + */ + public static BookRepayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookRepayment.class); + } + + /** + * Convert an instance of BookRepayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookRepaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfAttributes.java new file mode 100644 index 00000000..342871b2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfAttributes.java @@ -0,0 +1,385 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookRepaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookRepaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + PENDINGREVIEW("PendingReview"), + + SENT("Sent"), + + RETURNED("Returned"), + + REJECTED("Rejected"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public BookRepaymentAllOfAttributes() { + } + + public BookRepaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BookRepaymentAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public BookRepaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public BookRepaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public BookRepaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookRepaymentAllOfAttributes bookRepaymentAllOfAttributes = (BookRepaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, bookRepaymentAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, bookRepaymentAllOfAttributes.updatedAt) && + Objects.equals(this.amount, bookRepaymentAllOfAttributes.amount) && + Objects.equals(this.tags, bookRepaymentAllOfAttributes.tags) && + Objects.equals(this.status, bookRepaymentAllOfAttributes.status); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookRepaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("tags"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookRepaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookRepaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookRepaymentAllOfAttributes is not found in the empty JSON string", BookRepaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookRepaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookRepaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookRepaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookRepaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookRepaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookRepaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookRepaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookRepaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookRepaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookRepaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BookRepaymentAllOfAttributes + */ + public static BookRepaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookRepaymentAllOfAttributes.class); + } + + /** + * Convert an instance of BookRepaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationships.java b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationships.java new file mode 100644 index 00000000..214331b7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationships.java @@ -0,0 +1,342 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsAccount; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCreditAccount; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsCustomer; +import org.openapitools.client.model.AchRepaymentAllOfRelationshipsPayment; +import org.openapitools.client.model.BookRepaymentAllOfRelationshipsCounterpartyAccount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookRepaymentAllOfRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookRepaymentAllOfRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AchRepaymentAllOfRelationshipsAccount account; + + public static final String SERIALIZED_NAME_CREDIT_ACCOUNT = "creditAccount"; + @SerializedName(SERIALIZED_NAME_CREDIT_ACCOUNT) + private AchRepaymentAllOfRelationshipsCreditAccount creditAccount; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT = "counterpartyAccount"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT) + private BookRepaymentAllOfRelationshipsCounterpartyAccount counterpartyAccount; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private AchRepaymentAllOfRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + private AchRepaymentAllOfRelationshipsPayment payment; + + public BookRepaymentAllOfRelationships() { + } + + public BookRepaymentAllOfRelationships account(AchRepaymentAllOfRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(AchRepaymentAllOfRelationshipsAccount account) { + this.account = account; + } + + + public BookRepaymentAllOfRelationships creditAccount(AchRepaymentAllOfRelationshipsCreditAccount creditAccount) { + + this.creditAccount = creditAccount; + return this; + } + + /** + * Get creditAccount + * @return creditAccount + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsCreditAccount getCreditAccount() { + return creditAccount; + } + + + public void setCreditAccount(AchRepaymentAllOfRelationshipsCreditAccount creditAccount) { + this.creditAccount = creditAccount; + } + + + public BookRepaymentAllOfRelationships counterpartyAccount(BookRepaymentAllOfRelationshipsCounterpartyAccount counterpartyAccount) { + + this.counterpartyAccount = counterpartyAccount; + return this; + } + + /** + * Get counterpartyAccount + * @return counterpartyAccount + **/ + @javax.annotation.Nullable + public BookRepaymentAllOfRelationshipsCounterpartyAccount getCounterpartyAccount() { + return counterpartyAccount; + } + + + public void setCounterpartyAccount(BookRepaymentAllOfRelationshipsCounterpartyAccount counterpartyAccount) { + this.counterpartyAccount = counterpartyAccount; + } + + + public BookRepaymentAllOfRelationships customer(AchRepaymentAllOfRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(AchRepaymentAllOfRelationshipsCustomer customer) { + this.customer = customer; + } + + + public BookRepaymentAllOfRelationships payment(AchRepaymentAllOfRelationshipsPayment payment) { + + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + **/ + @javax.annotation.Nullable + public AchRepaymentAllOfRelationshipsPayment getPayment() { + return payment; + } + + + public void setPayment(AchRepaymentAllOfRelationshipsPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookRepaymentAllOfRelationships bookRepaymentAllOfRelationships = (BookRepaymentAllOfRelationships) o; + return Objects.equals(this.account, bookRepaymentAllOfRelationships.account) && + Objects.equals(this.creditAccount, bookRepaymentAllOfRelationships.creditAccount) && + Objects.equals(this.counterpartyAccount, bookRepaymentAllOfRelationships.counterpartyAccount) && + Objects.equals(this.customer, bookRepaymentAllOfRelationships.customer) && + Objects.equals(this.payment, bookRepaymentAllOfRelationships.payment); + } + + @Override + public int hashCode() { + return Objects.hash(account, creditAccount, counterpartyAccount, customer, payment); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookRepaymentAllOfRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" creditAccount: ").append(toIndentedString(creditAccount)).append("\n"); + sb.append(" counterpartyAccount: ").append(toIndentedString(counterpartyAccount)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("creditAccount"); + openapiFields.add("counterpartyAccount"); + openapiFields.add("customer"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookRepaymentAllOfRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookRepaymentAllOfRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookRepaymentAllOfRelationships is not found in the empty JSON string", BookRepaymentAllOfRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookRepaymentAllOfRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookRepaymentAllOfRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + AchRepaymentAllOfRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + } + // validate the optional field `creditAccount` + if (jsonObj.get("creditAccount") != null && !jsonObj.get("creditAccount").isJsonNull()) { + AchRepaymentAllOfRelationshipsCreditAccount.validateJsonElement(jsonObj.get("creditAccount")); + } + // validate the optional field `counterpartyAccount` + if (jsonObj.get("counterpartyAccount") != null && !jsonObj.get("counterpartyAccount").isJsonNull()) { + BookRepaymentAllOfRelationshipsCounterpartyAccount.validateJsonElement(jsonObj.get("counterpartyAccount")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + AchRepaymentAllOfRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `payment` + if (jsonObj.get("payment") != null && !jsonObj.get("payment").isJsonNull()) { + AchRepaymentAllOfRelationshipsPayment.validateJsonElement(jsonObj.get("payment")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookRepaymentAllOfRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookRepaymentAllOfRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookRepaymentAllOfRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookRepaymentAllOfRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookRepaymentAllOfRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookRepaymentAllOfRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookRepaymentAllOfRelationships + * @throws IOException if the JSON string is invalid with respect to BookRepaymentAllOfRelationships + */ + public static BookRepaymentAllOfRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookRepaymentAllOfRelationships.class); + } + + /** + * Convert an instance of BookRepaymentAllOfRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationshipsCounterpartyAccount.java b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationshipsCounterpartyAccount.java new file mode 100644 index 00000000..46e01c8c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationshipsCounterpartyAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BookRepaymentAllOfRelationshipsCounterpartyAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookRepaymentAllOfRelationshipsCounterpartyAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookRepaymentAllOfRelationshipsCounterpartyAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private BookRepaymentAllOfRelationshipsCounterpartyAccountData data; + + public BookRepaymentAllOfRelationshipsCounterpartyAccount() { + } + + public BookRepaymentAllOfRelationshipsCounterpartyAccount data(BookRepaymentAllOfRelationshipsCounterpartyAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public BookRepaymentAllOfRelationshipsCounterpartyAccountData getData() { + return data; + } + + + public void setData(BookRepaymentAllOfRelationshipsCounterpartyAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookRepaymentAllOfRelationshipsCounterpartyAccount bookRepaymentAllOfRelationshipsCounterpartyAccount = (BookRepaymentAllOfRelationshipsCounterpartyAccount) o; + return Objects.equals(this.data, bookRepaymentAllOfRelationshipsCounterpartyAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookRepaymentAllOfRelationshipsCounterpartyAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookRepaymentAllOfRelationshipsCounterpartyAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookRepaymentAllOfRelationshipsCounterpartyAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookRepaymentAllOfRelationshipsCounterpartyAccount is not found in the empty JSON string", BookRepaymentAllOfRelationshipsCounterpartyAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookRepaymentAllOfRelationshipsCounterpartyAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookRepaymentAllOfRelationshipsCounterpartyAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookRepaymentAllOfRelationshipsCounterpartyAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + BookRepaymentAllOfRelationshipsCounterpartyAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookRepaymentAllOfRelationshipsCounterpartyAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookRepaymentAllOfRelationshipsCounterpartyAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookRepaymentAllOfRelationshipsCounterpartyAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookRepaymentAllOfRelationshipsCounterpartyAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookRepaymentAllOfRelationshipsCounterpartyAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookRepaymentAllOfRelationshipsCounterpartyAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookRepaymentAllOfRelationshipsCounterpartyAccount + * @throws IOException if the JSON string is invalid with respect to BookRepaymentAllOfRelationshipsCounterpartyAccount + */ + public static BookRepaymentAllOfRelationshipsCounterpartyAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookRepaymentAllOfRelationshipsCounterpartyAccount.class); + } + + /** + * Convert an instance of BookRepaymentAllOfRelationshipsCounterpartyAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationshipsCounterpartyAccountData.java b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationshipsCounterpartyAccountData.java new file mode 100644 index 00000000..74efff60 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookRepaymentAllOfRelationshipsCounterpartyAccountData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookRepaymentAllOfRelationshipsCounterpartyAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookRepaymentAllOfRelationshipsCounterpartyAccountData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "account"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public BookRepaymentAllOfRelationshipsCounterpartyAccountData() { + } + + public BookRepaymentAllOfRelationshipsCounterpartyAccountData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public BookRepaymentAllOfRelationshipsCounterpartyAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookRepaymentAllOfRelationshipsCounterpartyAccountData bookRepaymentAllOfRelationshipsCounterpartyAccountData = (BookRepaymentAllOfRelationshipsCounterpartyAccountData) o; + return Objects.equals(this.type, bookRepaymentAllOfRelationshipsCounterpartyAccountData.type) && + Objects.equals(this.id, bookRepaymentAllOfRelationshipsCounterpartyAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookRepaymentAllOfRelationshipsCounterpartyAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookRepaymentAllOfRelationshipsCounterpartyAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookRepaymentAllOfRelationshipsCounterpartyAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookRepaymentAllOfRelationshipsCounterpartyAccountData is not found in the empty JSON string", BookRepaymentAllOfRelationshipsCounterpartyAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookRepaymentAllOfRelationshipsCounterpartyAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookRepaymentAllOfRelationshipsCounterpartyAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookRepaymentAllOfRelationshipsCounterpartyAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookRepaymentAllOfRelationshipsCounterpartyAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookRepaymentAllOfRelationshipsCounterpartyAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookRepaymentAllOfRelationshipsCounterpartyAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookRepaymentAllOfRelationshipsCounterpartyAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookRepaymentAllOfRelationshipsCounterpartyAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookRepaymentAllOfRelationshipsCounterpartyAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookRepaymentAllOfRelationshipsCounterpartyAccountData + * @throws IOException if the JSON string is invalid with respect to BookRepaymentAllOfRelationshipsCounterpartyAccountData + */ + public static BookRepaymentAllOfRelationshipsCounterpartyAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookRepaymentAllOfRelationshipsCounterpartyAccountData.class); + } + + /** + * Convert an instance of BookRepaymentAllOfRelationshipsCounterpartyAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookTransaction.java b/src/main/java/org/openapitools/client/model/BookTransaction.java new file mode 100644 index 00000000..32cc5e30 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BookTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BookTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public BookTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public BookTransaction attributes(BookTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BookTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BookTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BookTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookTransaction bookTransaction = (BookTransaction) o; + return Objects.equals(this.attributes, bookTransaction.attributes) && + Objects.equals(this.relationships, bookTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookTransaction is not found in the empty JSON string", BookTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookTransaction + * @throws IOException if the JSON string is invalid with respect to BookTransaction + */ + public static BookTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookTransaction.class); + } + + /** + * Convert an instance of BookTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BookTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BookTransactionAllOfAttributes.java new file mode 100644 index 00000000..99b2adc9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BookTransactionAllOfAttributes.java @@ -0,0 +1,443 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BookTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BookTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public BookTransactionAllOfAttributes() { + } + + public BookTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BookTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public BookTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public BookTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public BookTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public BookTransactionAllOfAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public BookTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BookTransactionAllOfAttributes bookTransactionAllOfAttributes = (BookTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, bookTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, bookTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, bookTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, bookTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, bookTransactionAllOfAttributes.summary) && + Objects.equals(this.counterparty, bookTransactionAllOfAttributes.counterparty) && + Objects.equals(this.tags, bookTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, counterparty, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BookTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("counterparty"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BookTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BookTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BookTransactionAllOfAttributes is not found in the empty JSON string", BookTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BookTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BookTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BookTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + // validate the required field `counterparty` + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BookTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BookTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BookTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BookTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BookTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BookTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BookTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BookTransactionAllOfAttributes + */ + public static BookTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BookTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of BookTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessAnnualRevenue.java b/src/main/java/org/openapitools/client/model/BusinessAnnualRevenue.java new file mode 100644 index 00000000..e93e4d59 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessAnnualRevenue.java @@ -0,0 +1,78 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets businessAnnualRevenue + */ +@JsonAdapter(BusinessAnnualRevenue.Adapter.class) +public enum BusinessAnnualRevenue { + + UPTO250K("UpTo250k"), + + BETWEEN250KAND500K("Between250kAnd500k"), + + BETWEEN500KAND1M("Between500kAnd1m"), + + BETWEEN1MAND5M("Between1mAnd5m"), + + OVER5M("Over5m"); + + private String value; + + BusinessAnnualRevenue(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static BusinessAnnualRevenue fromValue(String value) { + for (BusinessAnnualRevenue b : BusinessAnnualRevenue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final BusinessAnnualRevenue enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public BusinessAnnualRevenue read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BusinessAnnualRevenue.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessApplication.java b/src/main/java/org/openapitools/client/model/BusinessApplication.java new file mode 100644 index 00000000..2d130134 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessApplication.java @@ -0,0 +1,250 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.ApplicationRelationships; +import org.openapitools.client.model.BusinessApplicationAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessApplication extends Application { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BusinessApplicationAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private ApplicationRelationships relationships; + + public BusinessApplication() { + this.type = this.getClass().getSimpleName(); + } + + public BusinessApplication attributes(BusinessApplicationAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BusinessApplicationAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BusinessApplicationAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BusinessApplication relationships(ApplicationRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public ApplicationRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(ApplicationRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessApplication businessApplication = (BusinessApplication) o; + return Objects.equals(this.attributes, businessApplication.attributes) && + Objects.equals(this.relationships, businessApplication.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessApplication {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessApplication is not found in the empty JSON string", BusinessApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessApplication + * @throws IOException if the JSON string is invalid with respect to BusinessApplication + */ + public static BusinessApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessApplication.class); + } + + /** + * Convert an instance of BusinessApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessApplicationAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BusinessApplicationAllOfAttributes.java new file mode 100644 index 00000000..9c17f64c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessApplicationAllOfAttributes.java @@ -0,0 +1,1513 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.ApplicationStatus; +import org.openapitools.client.model.BeneficialOwner1; +import org.openapitools.client.model.BusinessAnnualRevenue; +import org.openapitools.client.model.BusinessNumberOfEmployees; +import org.openapitools.client.model.BusinessVertical; +import org.openapitools.client.model.CashFlow; +import org.openapitools.client.model.Contact; +import org.openapitools.client.model.EntityType; +import org.openapitools.client.model.Industry; +import org.openapitools.client.model.Officer1; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessApplicationAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessApplicationAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private ApplicationStatus status; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_EVALUATION_OUTCOME = "evaluationOutcome"; + @SerializedName(SERIALIZED_NAME_EVALUATION_OUTCOME) + private String evaluationOutcome; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_EVALUATION_ENTITY_ID = "evaluationEntityId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ENTITY_ID) + private String evaluationEntityId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_ENTITY_TYPE = "entityType"; + @SerializedName(SERIALIZED_NAME_ENTITY_TYPE) + private EntityType entityType; + + public static final String SERIALIZED_NAME_DATE_OF_INCORPORATION = "dateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_DATE_OF_INCORPORATION) + private LocalDate dateOfIncorporation; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_PURPOSE = "purpose"; + @SerializedName(SERIALIZED_NAME_PURPOSE) + private String purpose; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private Contact contact; + + public static final String SERIALIZED_NAME_OFFICER = "officer"; + @SerializedName(SERIALIZED_NAME_OFFICER) + private Officer1 officer; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; + + public static final String SERIALIZED_NAME_BENEFICIAL_OWNERS = "beneficialOwners"; + @SerializedName(SERIALIZED_NAME_BENEFICIAL_OWNERS) + private List beneficialOwners = new ArrayList<>(); + + /** + * Gets or Sets decisionMethod + */ + @JsonAdapter(DecisionMethodEnum.Adapter.class) + public enum DecisionMethodEnum { + MANUALLY("Manually"), + + AUTOMATICALLY("Automatically"); + + private String value; + + DecisionMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DecisionMethodEnum fromValue(String value) { + for (DecisionMethodEnum b : DecisionMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DecisionMethodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DecisionMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DecisionMethodEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DECISION_METHOD = "decisionMethod"; + @SerializedName(SERIALIZED_NAME_DECISION_METHOD) + private DecisionMethodEnum decisionMethod; + + public static final String SERIALIZED_NAME_DECISION_USER_ID = "decisionUserId"; + @SerializedName(SERIALIZED_NAME_DECISION_USER_ID) + private String decisionUserId; + + public static final String SERIALIZED_NAME_DECISION_REASON = "decisionReason"; + @SerializedName(SERIALIZED_NAME_DECISION_REASON) + private String decisionReason; + + public static final String SERIALIZED_NAME_DECISION_DATE_TIME = "decisionDateTime"; + @SerializedName(SERIALIZED_NAME_DECISION_DATE_TIME) + private OffsetDateTime decisionDateTime; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets riskRate + */ + @JsonAdapter(RiskRateEnum.Adapter.class) + public enum RiskRateEnum { + LOW("low"), + + MEDIUM("medium"), + + HIGH("high"); + + private String value; + + RiskRateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RiskRateEnum fromValue(String value) { + for (RiskRateEnum b : RiskRateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RiskRateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RiskRateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RiskRateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RISK_RATE = "riskRate"; + @SerializedName(SERIALIZED_NAME_RISK_RATE) + private RiskRateEnum riskRate; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_IP_LOCATION_DETAILS = "ipLocationDetails"; + @SerializedName(SERIALIZED_NAME_IP_LOCATION_DETAILS) + private Object ipLocationDetails; + + public static final String SERIALIZED_NAME_PHONE_LOCATION_DETAILS = "phoneLocationDetails"; + @SerializedName(SERIALIZED_NAME_PHONE_LOCATION_DETAILS) + private Object phoneLocationDetails; + + public static final String SERIALIZED_NAME_ARCHIVED = "archived"; + @SerializedName(SERIALIZED_NAME_ARCHIVED) + private Boolean archived; + + public static final String SERIALIZED_NAME_INDUSTRY = "industry"; + @SerializedName(SERIALIZED_NAME_INDUSTRY) + private Industry industry; + + public static final String SERIALIZED_NAME_ANNUAL_REVENUE = "annualRevenue"; + @SerializedName(SERIALIZED_NAME_ANNUAL_REVENUE) + private BusinessAnnualRevenue annualRevenue; + + public static final String SERIALIZED_NAME_NUMBER_OF_EMPLOYEES = "numberOfEmployees"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_EMPLOYEES) + private BusinessNumberOfEmployees numberOfEmployees; + + public static final String SERIALIZED_NAME_CASH_FLOW = "cashFlow"; + @SerializedName(SERIALIZED_NAME_CASH_FLOW) + private CashFlow cashFlow; + + public static final String SERIALIZED_NAME_YEAR_OF_INCORPORATION = "yearOfIncorporation"; + @SerializedName(SERIALIZED_NAME_YEAR_OF_INCORPORATION) + private String yearOfIncorporation; + + public static final String SERIALIZED_NAME_COUNTRIES_OF_OPERATION = "countriesOfOperation"; + @SerializedName(SERIALIZED_NAME_COUNTRIES_OF_OPERATION) + private List countriesOfOperation; + + public static final String SERIALIZED_NAME_STOCK_SYMBOL = "stockSymbol"; + @SerializedName(SERIALIZED_NAME_STOCK_SYMBOL) + private String stockSymbol; + + public static final String SERIALIZED_NAME_BUSINESS_VERTICAL = "businessVertical"; + @SerializedName(SERIALIZED_NAME_BUSINESS_VERTICAL) + private BusinessVertical businessVertical; + + public BusinessApplicationAllOfAttributes() { + } + + public BusinessApplicationAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BusinessApplicationAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public BusinessApplicationAllOfAttributes status(ApplicationStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public ApplicationStatus getStatus() { + return status; + } + + + public void setStatus(ApplicationStatus status) { + this.status = status; + } + + + public BusinessApplicationAllOfAttributes message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public BusinessApplicationAllOfAttributes evaluationOutcome(String evaluationOutcome) { + + this.evaluationOutcome = evaluationOutcome; + return this; + } + + /** + * Get evaluationOutcome + * @return evaluationOutcome + **/ + @javax.annotation.Nullable + public String getEvaluationOutcome() { + return evaluationOutcome; + } + + + public void setEvaluationOutcome(String evaluationOutcome) { + this.evaluationOutcome = evaluationOutcome; + } + + + public BusinessApplicationAllOfAttributes evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public BusinessApplicationAllOfAttributes evaluationEntityId(String evaluationEntityId) { + + this.evaluationEntityId = evaluationEntityId; + return this; + } + + /** + * Get evaluationEntityId + * @return evaluationEntityId + **/ + @javax.annotation.Nullable + public String getEvaluationEntityId() { + return evaluationEntityId; + } + + + public void setEvaluationEntityId(String evaluationEntityId) { + this.evaluationEntityId = evaluationEntityId; + } + + + public BusinessApplicationAllOfAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public BusinessApplicationAllOfAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public BusinessApplicationAllOfAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public BusinessApplicationAllOfAttributes entityType(EntityType entityType) { + + this.entityType = entityType; + return this; + } + + /** + * Get entityType + * @return entityType + **/ + @javax.annotation.Nonnull + public EntityType getEntityType() { + return entityType; + } + + + public void setEntityType(EntityType entityType) { + this.entityType = entityType; + } + + + public BusinessApplicationAllOfAttributes dateOfIncorporation(LocalDate dateOfIncorporation) { + + this.dateOfIncorporation = dateOfIncorporation; + return this; + } + + /** + * Get dateOfIncorporation + * @return dateOfIncorporation + **/ + @javax.annotation.Nullable + public LocalDate getDateOfIncorporation() { + return dateOfIncorporation; + } + + + public void setDateOfIncorporation(LocalDate dateOfIncorporation) { + this.dateOfIncorporation = dateOfIncorporation; + } + + + public BusinessApplicationAllOfAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nonnull + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public BusinessApplicationAllOfAttributes purpose(String purpose) { + + this.purpose = purpose; + return this; + } + + /** + * Get purpose + * @return purpose + **/ + @javax.annotation.Nullable + public String getPurpose() { + return purpose; + } + + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + + public BusinessApplicationAllOfAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public BusinessApplicationAllOfAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public BusinessApplicationAllOfAttributes contact(Contact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nonnull + public Contact getContact() { + return contact; + } + + + public void setContact(Contact contact) { + this.contact = contact; + } + + + public BusinessApplicationAllOfAttributes officer(Officer1 officer) { + + this.officer = officer; + return this; + } + + /** + * Get officer + * @return officer + **/ + @javax.annotation.Nonnull + public Officer1 getOfficer() { + return officer; + } + + + public void setOfficer(Officer1 officer) { + this.officer = officer; + } + + + public BusinessApplicationAllOfAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public BusinessApplicationAllOfAttributes website(String website) { + + this.website = website; + return this; + } + + /** + * Get website + * @return website + **/ + @javax.annotation.Nullable + public String getWebsite() { + return website; + } + + + public void setWebsite(String website) { + this.website = website; + } + + + public BusinessApplicationAllOfAttributes beneficialOwners(List beneficialOwners) { + + this.beneficialOwners = beneficialOwners; + return this; + } + + public BusinessApplicationAllOfAttributes addBeneficialOwnersItem(BeneficialOwner1 beneficialOwnersItem) { + if (this.beneficialOwners == null) { + this.beneficialOwners = new ArrayList<>(); + } + this.beneficialOwners.add(beneficialOwnersItem); + return this; + } + + /** + * Get beneficialOwners + * @return beneficialOwners + **/ + @javax.annotation.Nonnull + public List getBeneficialOwners() { + return beneficialOwners; + } + + + public void setBeneficialOwners(List beneficialOwners) { + this.beneficialOwners = beneficialOwners; + } + + + public BusinessApplicationAllOfAttributes decisionMethod(DecisionMethodEnum decisionMethod) { + + this.decisionMethod = decisionMethod; + return this; + } + + /** + * Get decisionMethod + * @return decisionMethod + **/ + @javax.annotation.Nullable + public DecisionMethodEnum getDecisionMethod() { + return decisionMethod; + } + + + public void setDecisionMethod(DecisionMethodEnum decisionMethod) { + this.decisionMethod = decisionMethod; + } + + + public BusinessApplicationAllOfAttributes decisionUserId(String decisionUserId) { + + this.decisionUserId = decisionUserId; + return this; + } + + /** + * Get decisionUserId + * @return decisionUserId + **/ + @javax.annotation.Nullable + public String getDecisionUserId() { + return decisionUserId; + } + + + public void setDecisionUserId(String decisionUserId) { + this.decisionUserId = decisionUserId; + } + + + public BusinessApplicationAllOfAttributes decisionReason(String decisionReason) { + + this.decisionReason = decisionReason; + return this; + } + + /** + * Get decisionReason + * @return decisionReason + **/ + @javax.annotation.Nullable + public String getDecisionReason() { + return decisionReason; + } + + + public void setDecisionReason(String decisionReason) { + this.decisionReason = decisionReason; + } + + + public BusinessApplicationAllOfAttributes decisionDateTime(OffsetDateTime decisionDateTime) { + + this.decisionDateTime = decisionDateTime; + return this; + } + + /** + * Get decisionDateTime + * @return decisionDateTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getDecisionDateTime() { + return decisionDateTime; + } + + + public void setDecisionDateTime(OffsetDateTime decisionDateTime) { + this.decisionDateTime = decisionDateTime; + } + + + public BusinessApplicationAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public BusinessApplicationAllOfAttributes riskRate(RiskRateEnum riskRate) { + + this.riskRate = riskRate; + return this; + } + + /** + * Get riskRate + * @return riskRate + **/ + @javax.annotation.Nullable + public RiskRateEnum getRiskRate() { + return riskRate; + } + + + public void setRiskRate(RiskRateEnum riskRate) { + this.riskRate = riskRate; + } + + + public BusinessApplicationAllOfAttributes evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public BusinessApplicationAllOfAttributes addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public BusinessApplicationAllOfAttributes ipLocationDetails(Object ipLocationDetails) { + + this.ipLocationDetails = ipLocationDetails; + return this; + } + + /** + * Get ipLocationDetails + * @return ipLocationDetails + **/ + @javax.annotation.Nullable + public Object getIpLocationDetails() { + return ipLocationDetails; + } + + + public void setIpLocationDetails(Object ipLocationDetails) { + this.ipLocationDetails = ipLocationDetails; + } + + + public BusinessApplicationAllOfAttributes phoneLocationDetails(Object phoneLocationDetails) { + + this.phoneLocationDetails = phoneLocationDetails; + return this; + } + + /** + * Get phoneLocationDetails + * @return phoneLocationDetails + **/ + @javax.annotation.Nullable + public Object getPhoneLocationDetails() { + return phoneLocationDetails; + } + + + public void setPhoneLocationDetails(Object phoneLocationDetails) { + this.phoneLocationDetails = phoneLocationDetails; + } + + + public BusinessApplicationAllOfAttributes archived(Boolean archived) { + + this.archived = archived; + return this; + } + + /** + * Get archived + * @return archived + **/ + @javax.annotation.Nullable + public Boolean getArchived() { + return archived; + } + + + public void setArchived(Boolean archived) { + this.archived = archived; + } + + + public BusinessApplicationAllOfAttributes industry(Industry industry) { + + this.industry = industry; + return this; + } + + /** + * Get industry + * @return industry + **/ + @javax.annotation.Nullable + public Industry getIndustry() { + return industry; + } + + + public void setIndustry(Industry industry) { + this.industry = industry; + } + + + public BusinessApplicationAllOfAttributes annualRevenue(BusinessAnnualRevenue annualRevenue) { + + this.annualRevenue = annualRevenue; + return this; + } + + /** + * Get annualRevenue + * @return annualRevenue + **/ + @javax.annotation.Nullable + public BusinessAnnualRevenue getAnnualRevenue() { + return annualRevenue; + } + + + public void setAnnualRevenue(BusinessAnnualRevenue annualRevenue) { + this.annualRevenue = annualRevenue; + } + + + public BusinessApplicationAllOfAttributes numberOfEmployees(BusinessNumberOfEmployees numberOfEmployees) { + + this.numberOfEmployees = numberOfEmployees; + return this; + } + + /** + * Get numberOfEmployees + * @return numberOfEmployees + **/ + @javax.annotation.Nullable + public BusinessNumberOfEmployees getNumberOfEmployees() { + return numberOfEmployees; + } + + + public void setNumberOfEmployees(BusinessNumberOfEmployees numberOfEmployees) { + this.numberOfEmployees = numberOfEmployees; + } + + + public BusinessApplicationAllOfAttributes cashFlow(CashFlow cashFlow) { + + this.cashFlow = cashFlow; + return this; + } + + /** + * Get cashFlow + * @return cashFlow + **/ + @javax.annotation.Nullable + public CashFlow getCashFlow() { + return cashFlow; + } + + + public void setCashFlow(CashFlow cashFlow) { + this.cashFlow = cashFlow; + } + + + public BusinessApplicationAllOfAttributes yearOfIncorporation(String yearOfIncorporation) { + + this.yearOfIncorporation = yearOfIncorporation; + return this; + } + + /** + * Get yearOfIncorporation + * @return yearOfIncorporation + **/ + @javax.annotation.Nullable + public String getYearOfIncorporation() { + return yearOfIncorporation; + } + + + public void setYearOfIncorporation(String yearOfIncorporation) { + this.yearOfIncorporation = yearOfIncorporation; + } + + + public BusinessApplicationAllOfAttributes countriesOfOperation(List countriesOfOperation) { + + this.countriesOfOperation = countriesOfOperation; + return this; + } + + public BusinessApplicationAllOfAttributes addCountriesOfOperationItem(String countriesOfOperationItem) { + if (this.countriesOfOperation == null) { + this.countriesOfOperation = new ArrayList<>(); + } + this.countriesOfOperation.add(countriesOfOperationItem); + return this; + } + + /** + * Get countriesOfOperation + * @return countriesOfOperation + **/ + @javax.annotation.Nullable + public List getCountriesOfOperation() { + return countriesOfOperation; + } + + + public void setCountriesOfOperation(List countriesOfOperation) { + this.countriesOfOperation = countriesOfOperation; + } + + + public BusinessApplicationAllOfAttributes stockSymbol(String stockSymbol) { + + this.stockSymbol = stockSymbol; + return this; + } + + /** + * Get stockSymbol + * @return stockSymbol + **/ + @javax.annotation.Nullable + public String getStockSymbol() { + return stockSymbol; + } + + + public void setStockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + } + + + public BusinessApplicationAllOfAttributes businessVertical(BusinessVertical businessVertical) { + + this.businessVertical = businessVertical; + return this; + } + + /** + * Get businessVertical + * @return businessVertical + **/ + @javax.annotation.Nullable + public BusinessVertical getBusinessVertical() { + return businessVertical; + } + + + public void setBusinessVertical(BusinessVertical businessVertical) { + this.businessVertical = businessVertical; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessApplicationAllOfAttributes businessApplicationAllOfAttributes = (BusinessApplicationAllOfAttributes) o; + return Objects.equals(this.createdAt, businessApplicationAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, businessApplicationAllOfAttributes.updatedAt) && + Objects.equals(this.status, businessApplicationAllOfAttributes.status) && + Objects.equals(this.message, businessApplicationAllOfAttributes.message) && + Objects.equals(this.evaluationOutcome, businessApplicationAllOfAttributes.evaluationOutcome) && + Objects.equals(this.evaluationId, businessApplicationAllOfAttributes.evaluationId) && + Objects.equals(this.evaluationEntityId, businessApplicationAllOfAttributes.evaluationEntityId) && + Objects.equals(this.name, businessApplicationAllOfAttributes.name) && + Objects.equals(this.dba, businessApplicationAllOfAttributes.dba) && + Objects.equals(this.ein, businessApplicationAllOfAttributes.ein) && + Objects.equals(this.entityType, businessApplicationAllOfAttributes.entityType) && + Objects.equals(this.dateOfIncorporation, businessApplicationAllOfAttributes.dateOfIncorporation) && + Objects.equals(this.stateOfIncorporation, businessApplicationAllOfAttributes.stateOfIncorporation) && + Objects.equals(this.purpose, businessApplicationAllOfAttributes.purpose) && + Objects.equals(this.phone, businessApplicationAllOfAttributes.phone) && + Objects.equals(this.address, businessApplicationAllOfAttributes.address) && + Objects.equals(this.contact, businessApplicationAllOfAttributes.contact) && + Objects.equals(this.officer, businessApplicationAllOfAttributes.officer) && + Objects.equals(this.ip, businessApplicationAllOfAttributes.ip) && + Objects.equals(this.website, businessApplicationAllOfAttributes.website) && + Objects.equals(this.beneficialOwners, businessApplicationAllOfAttributes.beneficialOwners) && + Objects.equals(this.decisionMethod, businessApplicationAllOfAttributes.decisionMethod) && + Objects.equals(this.decisionUserId, businessApplicationAllOfAttributes.decisionUserId) && + Objects.equals(this.decisionReason, businessApplicationAllOfAttributes.decisionReason) && + Objects.equals(this.decisionDateTime, businessApplicationAllOfAttributes.decisionDateTime) && + Objects.equals(this.tags, businessApplicationAllOfAttributes.tags) && + Objects.equals(this.riskRate, businessApplicationAllOfAttributes.riskRate) && + Objects.equals(this.evaluationFlags, businessApplicationAllOfAttributes.evaluationFlags) && + Objects.equals(this.ipLocationDetails, businessApplicationAllOfAttributes.ipLocationDetails) && + Objects.equals(this.phoneLocationDetails, businessApplicationAllOfAttributes.phoneLocationDetails) && + Objects.equals(this.archived, businessApplicationAllOfAttributes.archived) && + Objects.equals(this.industry, businessApplicationAllOfAttributes.industry) && + Objects.equals(this.annualRevenue, businessApplicationAllOfAttributes.annualRevenue) && + Objects.equals(this.numberOfEmployees, businessApplicationAllOfAttributes.numberOfEmployees) && + Objects.equals(this.cashFlow, businessApplicationAllOfAttributes.cashFlow) && + Objects.equals(this.yearOfIncorporation, businessApplicationAllOfAttributes.yearOfIncorporation) && + Objects.equals(this.countriesOfOperation, businessApplicationAllOfAttributes.countriesOfOperation) && + Objects.equals(this.stockSymbol, businessApplicationAllOfAttributes.stockSymbol) && + Objects.equals(this.businessVertical, businessApplicationAllOfAttributes.businessVertical); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, status, message, evaluationOutcome, evaluationId, evaluationEntityId, name, dba, ein, entityType, dateOfIncorporation, stateOfIncorporation, purpose, phone, address, contact, officer, ip, website, beneficialOwners, decisionMethod, decisionUserId, decisionReason, decisionDateTime, tags, riskRate, evaluationFlags, ipLocationDetails, phoneLocationDetails, archived, industry, annualRevenue, numberOfEmployees, cashFlow, yearOfIncorporation, countriesOfOperation, stockSymbol, businessVertical); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessApplicationAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" evaluationOutcome: ").append(toIndentedString(evaluationOutcome)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" evaluationEntityId: ").append(toIndentedString(evaluationEntityId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); + sb.append(" dateOfIncorporation: ").append(toIndentedString(dateOfIncorporation)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" purpose: ").append(toIndentedString(purpose)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" officer: ").append(toIndentedString(officer)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append(" beneficialOwners: ").append(toIndentedString(beneficialOwners)).append("\n"); + sb.append(" decisionMethod: ").append(toIndentedString(decisionMethod)).append("\n"); + sb.append(" decisionUserId: ").append(toIndentedString(decisionUserId)).append("\n"); + sb.append(" decisionReason: ").append(toIndentedString(decisionReason)).append("\n"); + sb.append(" decisionDateTime: ").append(toIndentedString(decisionDateTime)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" riskRate: ").append(toIndentedString(riskRate)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" ipLocationDetails: ").append(toIndentedString(ipLocationDetails)).append("\n"); + sb.append(" phoneLocationDetails: ").append(toIndentedString(phoneLocationDetails)).append("\n"); + sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); + sb.append(" industry: ").append(toIndentedString(industry)).append("\n"); + sb.append(" annualRevenue: ").append(toIndentedString(annualRevenue)).append("\n"); + sb.append(" numberOfEmployees: ").append(toIndentedString(numberOfEmployees)).append("\n"); + sb.append(" cashFlow: ").append(toIndentedString(cashFlow)).append("\n"); + sb.append(" yearOfIncorporation: ").append(toIndentedString(yearOfIncorporation)).append("\n"); + sb.append(" countriesOfOperation: ").append(toIndentedString(countriesOfOperation)).append("\n"); + sb.append(" stockSymbol: ").append(toIndentedString(stockSymbol)).append("\n"); + sb.append(" businessVertical: ").append(toIndentedString(businessVertical)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("status"); + openapiFields.add("message"); + openapiFields.add("evaluationOutcome"); + openapiFields.add("evaluationId"); + openapiFields.add("evaluationEntityId"); + openapiFields.add("name"); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("entityType"); + openapiFields.add("dateOfIncorporation"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("purpose"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("contact"); + openapiFields.add("officer"); + openapiFields.add("ip"); + openapiFields.add("website"); + openapiFields.add("beneficialOwners"); + openapiFields.add("decisionMethod"); + openapiFields.add("decisionUserId"); + openapiFields.add("decisionReason"); + openapiFields.add("decisionDateTime"); + openapiFields.add("tags"); + openapiFields.add("riskRate"); + openapiFields.add("evaluationFlags"); + openapiFields.add("ipLocationDetails"); + openapiFields.add("phoneLocationDetails"); + openapiFields.add("archived"); + openapiFields.add("industry"); + openapiFields.add("annualRevenue"); + openapiFields.add("numberOfEmployees"); + openapiFields.add("cashFlow"); + openapiFields.add("yearOfIncorporation"); + openapiFields.add("countriesOfOperation"); + openapiFields.add("stockSymbol"); + openapiFields.add("businessVertical"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("entityType"); + openapiRequiredFields.add("stateOfIncorporation"); + openapiRequiredFields.add("contact"); + openapiRequiredFields.add("officer"); + openapiRequiredFields.add("beneficialOwners"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessApplicationAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessApplicationAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessApplicationAllOfAttributes is not found in the empty JSON string", BusinessApplicationAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessApplicationAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessApplicationAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessApplicationAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("evaluationOutcome") != null && !jsonObj.get("evaluationOutcome").isJsonNull()) && !jsonObj.get("evaluationOutcome").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationOutcome` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationOutcome").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + if ((jsonObj.get("evaluationEntityId") != null && !jsonObj.get("evaluationEntityId").isJsonNull()) && !jsonObj.get("evaluationEntityId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationEntityId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationEntityId").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if (!jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + if ((jsonObj.get("purpose") != null && !jsonObj.get("purpose").isJsonNull()) && !jsonObj.get("purpose").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `purpose` to be a primitive type in the JSON string but got `%s`", jsonObj.get("purpose").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + // validate the required field `contact` + Contact.validateJsonElement(jsonObj.get("contact")); + // validate the required field `officer` + Officer1.validateJsonElement(jsonObj.get("officer")); + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `website` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("beneficialOwners").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficialOwners` to be an array in the JSON string but got `%s`", jsonObj.get("beneficialOwners").toString())); + } + + JsonArray jsonArraybeneficialOwners = jsonObj.getAsJsonArray("beneficialOwners"); + // validate the required field `beneficialOwners` (array) + for (int i = 0; i < jsonArraybeneficialOwners.size(); i++) { + BeneficialOwner1.validateJsonElement(jsonArraybeneficialOwners.get(i)); + }; + if ((jsonObj.get("decisionMethod") != null && !jsonObj.get("decisionMethod").isJsonNull()) && !jsonObj.get("decisionMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionMethod").toString())); + } + if ((jsonObj.get("decisionUserId") != null && !jsonObj.get("decisionUserId").isJsonNull()) && !jsonObj.get("decisionUserId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionUserId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionUserId").toString())); + } + if ((jsonObj.get("decisionReason") != null && !jsonObj.get("decisionReason").isJsonNull()) && !jsonObj.get("decisionReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionReason").toString())); + } + if ((jsonObj.get("riskRate") != null && !jsonObj.get("riskRate").isJsonNull()) && !jsonObj.get("riskRate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `riskRate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskRate").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + if ((jsonObj.get("yearOfIncorporation") != null && !jsonObj.get("yearOfIncorporation").isJsonNull()) && !jsonObj.get("yearOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `yearOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yearOfIncorporation").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("countriesOfOperation") != null && !jsonObj.get("countriesOfOperation").isJsonNull() && !jsonObj.get("countriesOfOperation").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `countriesOfOperation` to be an array in the JSON string but got `%s`", jsonObj.get("countriesOfOperation").toString())); + } + if ((jsonObj.get("stockSymbol") != null && !jsonObj.get("stockSymbol").isJsonNull()) && !jsonObj.get("stockSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stockSymbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stockSymbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessApplicationAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessApplicationAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessApplicationAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessApplicationAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessApplicationAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessApplicationAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessApplicationAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BusinessApplicationAllOfAttributes + */ + public static BusinessApplicationAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessApplicationAllOfAttributes.class); + } + + /** + * Convert an instance of BusinessApplicationAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessCreditCard.java b/src/main/java/org/openapitools/client/model/BusinessCreditCard.java new file mode 100644 index 00000000..75b65362 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessCreditCard.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BusinessDebitCardAllOfAttributes; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.CardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessCreditCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessCreditCard extends Card { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BusinessDebitCardAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CardRelationships relationships; + + public BusinessCreditCard() { + this.type = this.getClass().getSimpleName(); + } + + public BusinessCreditCard attributes(BusinessDebitCardAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BusinessDebitCardAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BusinessDebitCardAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BusinessCreditCard relationships(CardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessCreditCard businessCreditCard = (BusinessCreditCard) o; + return Objects.equals(this.attributes, businessCreditCard.attributes) && + Objects.equals(this.relationships, businessCreditCard.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessCreditCard {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessCreditCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessCreditCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessCreditCard is not found in the empty JSON string", BusinessCreditCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessCreditCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessCreditCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessCreditCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessCreditCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessCreditCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessCreditCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessCreditCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessCreditCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessCreditCard + * @throws IOException if the JSON string is invalid with respect to BusinessCreditCard + */ + public static BusinessCreditCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessCreditCard.class); + } + + /** + * Convert an instance of BusinessCreditCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessCustomer.java b/src/main/java/org/openapitools/client/model/BusinessCustomer.java new file mode 100644 index 00000000..ca77a8c0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessCustomer.java @@ -0,0 +1,240 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BusinessCustomerAllOfAttributes; +import org.openapitools.client.model.Customer; +import org.openapitools.client.model.CustomerRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessCustomer extends Customer { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BusinessCustomerAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CustomerRelationships relationships; + + public BusinessCustomer() { + this.type = this.getClass().getSimpleName(); + } + + public BusinessCustomer attributes(BusinessCustomerAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public BusinessCustomerAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BusinessCustomerAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BusinessCustomer relationships(CustomerRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CustomerRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CustomerRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessCustomer businessCustomer = (BusinessCustomer) o; + return Objects.equals(this.attributes, businessCustomer.attributes) && + Objects.equals(this.relationships, businessCustomer.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessCustomer {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessCustomer is not found in the empty JSON string", BusinessCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessCustomer + * @throws IOException if the JSON string is invalid with respect to BusinessCustomer + */ + public static BusinessCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessCustomer.class); + } + + /** + * Convert an instance of BusinessCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessCustomerAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BusinessCustomerAllOfAttributes.java new file mode 100644 index 00000000..fe23d4a0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessCustomerAllOfAttributes.java @@ -0,0 +1,857 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AuthorizedUser; +import org.openapitools.client.model.Contact; +import org.openapitools.client.model.EntityType; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessCustomerAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessCustomerAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_ENTITY_TYPE = "entityType"; + @SerializedName(SERIALIZED_NAME_ENTITY_TYPE) + private EntityType entityType; + + public static final String SERIALIZED_NAME_DATE_OF_INCORPORATION = "dateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_DATE_OF_INCORPORATION) + private LocalDate dateOfIncorporation; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_PURPOSE = "purpose"; + @SerializedName(SERIALIZED_NAME_PURPOSE) + private String purpose; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private Contact contact; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets riskRate + */ + @JsonAdapter(RiskRateEnum.Adapter.class) + public enum RiskRateEnum { + LOW("low"), + + MEDIUM("medium"), + + HIGH("high"); + + private String value; + + RiskRateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RiskRateEnum fromValue(String value) { + for (RiskRateEnum b : RiskRateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RiskRateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RiskRateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RiskRateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RISK_RATE = "riskRate"; + @SerializedName(SERIALIZED_NAME_RISK_RATE) + private RiskRateEnum riskRate; + + public static final String SERIALIZED_NAME_AUTHORIZED_USERS = "authorizedUsers"; + @SerializedName(SERIALIZED_NAME_AUTHORIZED_USERS) + private List authorizedUsers; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("Active"), + + ARCHIVED("Archived"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + /** + * Gets or Sets archiveReason + */ + @JsonAdapter(ArchiveReasonEnum.Adapter.class) + public enum ArchiveReasonEnum { + INACTIVE("Inactive"), + + FRAUDACHACTIVITY("FraudACHActivity"), + + FRAUDCARDACTIVITY("FraudCardActivity"), + + FRAUDCHECKACTIVITY("FraudCheckActivity"), + + FRAUDAPPLICATIONHISTORY("FraudApplicationHistory"), + + FRAUDACCOUNTACTIVITY("FraudAccountActivity"), + + FRAUDCLIENTIDENTIFIED("FraudClientIdentified"), + + FRAUDLINKEDTOFRAUDULENTCUSTOMER("FraudLinkedToFraudulentCustomer"); + + private String value; + + ArchiveReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ArchiveReasonEnum fromValue(String value) { + for (ArchiveReasonEnum b : ArchiveReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArchiveReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArchiveReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArchiveReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ARCHIVE_REASON = "archiveReason"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_REASON) + private ArchiveReasonEnum archiveReason; + + public BusinessCustomerAllOfAttributes() { + } + + public BusinessCustomerAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BusinessCustomerAllOfAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public BusinessCustomerAllOfAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public BusinessCustomerAllOfAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public BusinessCustomerAllOfAttributes entityType(EntityType entityType) { + + this.entityType = entityType; + return this; + } + + /** + * Get entityType + * @return entityType + **/ + @javax.annotation.Nonnull + public EntityType getEntityType() { + return entityType; + } + + + public void setEntityType(EntityType entityType) { + this.entityType = entityType; + } + + + public BusinessCustomerAllOfAttributes dateOfIncorporation(LocalDate dateOfIncorporation) { + + this.dateOfIncorporation = dateOfIncorporation; + return this; + } + + /** + * Get dateOfIncorporation + * @return dateOfIncorporation + **/ + @javax.annotation.Nullable + public LocalDate getDateOfIncorporation() { + return dateOfIncorporation; + } + + + public void setDateOfIncorporation(LocalDate dateOfIncorporation) { + this.dateOfIncorporation = dateOfIncorporation; + } + + + public BusinessCustomerAllOfAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nonnull + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public BusinessCustomerAllOfAttributes purpose(String purpose) { + + this.purpose = purpose; + return this; + } + + /** + * Get purpose + * @return purpose + **/ + @javax.annotation.Nullable + public String getPurpose() { + return purpose; + } + + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + + public BusinessCustomerAllOfAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public BusinessCustomerAllOfAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public BusinessCustomerAllOfAttributes contact(Contact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nonnull + public Contact getContact() { + return contact; + } + + + public void setContact(Contact contact) { + this.contact = contact; + } + + + public BusinessCustomerAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public BusinessCustomerAllOfAttributes riskRate(RiskRateEnum riskRate) { + + this.riskRate = riskRate; + return this; + } + + /** + * Get riskRate + * @return riskRate + **/ + @javax.annotation.Nullable + public RiskRateEnum getRiskRate() { + return riskRate; + } + + + public void setRiskRate(RiskRateEnum riskRate) { + this.riskRate = riskRate; + } + + + public BusinessCustomerAllOfAttributes authorizedUsers(List authorizedUsers) { + + this.authorizedUsers = authorizedUsers; + return this; + } + + public BusinessCustomerAllOfAttributes addAuthorizedUsersItem(AuthorizedUser authorizedUsersItem) { + if (this.authorizedUsers == null) { + this.authorizedUsers = new ArrayList<>(); + } + this.authorizedUsers.add(authorizedUsersItem); + return this; + } + + /** + * Get authorizedUsers + * @return authorizedUsers + **/ + @javax.annotation.Nullable + public List getAuthorizedUsers() { + return authorizedUsers; + } + + + public void setAuthorizedUsers(List authorizedUsers) { + this.authorizedUsers = authorizedUsers; + } + + + public BusinessCustomerAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public BusinessCustomerAllOfAttributes archiveReason(ArchiveReasonEnum archiveReason) { + + this.archiveReason = archiveReason; + return this; + } + + /** + * Get archiveReason + * @return archiveReason + **/ + @javax.annotation.Nullable + public ArchiveReasonEnum getArchiveReason() { + return archiveReason; + } + + + public void setArchiveReason(ArchiveReasonEnum archiveReason) { + this.archiveReason = archiveReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessCustomerAllOfAttributes businessCustomerAllOfAttributes = (BusinessCustomerAllOfAttributes) o; + return Objects.equals(this.createdAt, businessCustomerAllOfAttributes.createdAt) && + Objects.equals(this.name, businessCustomerAllOfAttributes.name) && + Objects.equals(this.dba, businessCustomerAllOfAttributes.dba) && + Objects.equals(this.ein, businessCustomerAllOfAttributes.ein) && + Objects.equals(this.entityType, businessCustomerAllOfAttributes.entityType) && + Objects.equals(this.dateOfIncorporation, businessCustomerAllOfAttributes.dateOfIncorporation) && + Objects.equals(this.stateOfIncorporation, businessCustomerAllOfAttributes.stateOfIncorporation) && + Objects.equals(this.purpose, businessCustomerAllOfAttributes.purpose) && + Objects.equals(this.phone, businessCustomerAllOfAttributes.phone) && + Objects.equals(this.address, businessCustomerAllOfAttributes.address) && + Objects.equals(this.contact, businessCustomerAllOfAttributes.contact) && + Objects.equals(this.tags, businessCustomerAllOfAttributes.tags) && + Objects.equals(this.riskRate, businessCustomerAllOfAttributes.riskRate) && + Objects.equals(this.authorizedUsers, businessCustomerAllOfAttributes.authorizedUsers) && + Objects.equals(this.status, businessCustomerAllOfAttributes.status) && + Objects.equals(this.archiveReason, businessCustomerAllOfAttributes.archiveReason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, name, dba, ein, entityType, dateOfIncorporation, stateOfIncorporation, purpose, phone, address, contact, tags, riskRate, authorizedUsers, status, archiveReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessCustomerAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); + sb.append(" dateOfIncorporation: ").append(toIndentedString(dateOfIncorporation)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" purpose: ").append(toIndentedString(purpose)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" riskRate: ").append(toIndentedString(riskRate)).append("\n"); + sb.append(" authorizedUsers: ").append(toIndentedString(authorizedUsers)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" archiveReason: ").append(toIndentedString(archiveReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("name"); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("entityType"); + openapiFields.add("dateOfIncorporation"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("purpose"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("contact"); + openapiFields.add("tags"); + openapiFields.add("riskRate"); + openapiFields.add("authorizedUsers"); + openapiFields.add("status"); + openapiFields.add("archiveReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("entityType"); + openapiRequiredFields.add("stateOfIncorporation"); + openapiRequiredFields.add("contact"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessCustomerAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessCustomerAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessCustomerAllOfAttributes is not found in the empty JSON string", BusinessCustomerAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessCustomerAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessCustomerAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessCustomerAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if (!jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + if ((jsonObj.get("purpose") != null && !jsonObj.get("purpose").isJsonNull()) && !jsonObj.get("purpose").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `purpose` to be a primitive type in the JSON string but got `%s`", jsonObj.get("purpose").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + // validate the required field `contact` + Contact.validateJsonElement(jsonObj.get("contact")); + if ((jsonObj.get("riskRate") != null && !jsonObj.get("riskRate").isJsonNull()) && !jsonObj.get("riskRate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `riskRate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskRate").toString())); + } + if (jsonObj.get("authorizedUsers") != null && !jsonObj.get("authorizedUsers").isJsonNull()) { + JsonArray jsonArrayauthorizedUsers = jsonObj.getAsJsonArray("authorizedUsers"); + if (jsonArrayauthorizedUsers != null) { + // ensure the json data is an array + if (!jsonObj.get("authorizedUsers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `authorizedUsers` to be an array in the JSON string but got `%s`", jsonObj.get("authorizedUsers").toString())); + } + + // validate the optional field `authorizedUsers` (array) + for (int i = 0; i < jsonArrayauthorizedUsers.size(); i++) { + AuthorizedUser.validateJsonElement(jsonArrayauthorizedUsers.get(i)); + }; + } + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("archiveReason") != null && !jsonObj.get("archiveReason").isJsonNull()) && !jsonObj.get("archiveReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `archiveReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archiveReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessCustomerAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessCustomerAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessCustomerAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessCustomerAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessCustomerAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessCustomerAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessCustomerAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BusinessCustomerAllOfAttributes + */ + public static BusinessCustomerAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessCustomerAllOfAttributes.class); + } + + /** + * Convert an instance of BusinessCustomerAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessDebitCard.java b/src/main/java/org/openapitools/client/model/BusinessDebitCard.java new file mode 100644 index 00000000..037f3b65 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessDebitCard.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BusinessDebitCardAllOfAttributes; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.CardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessDebitCard extends Card { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BusinessDebitCardAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CardRelationships relationships; + + public BusinessDebitCard() { + this.type = this.getClass().getSimpleName(); + } + + public BusinessDebitCard attributes(BusinessDebitCardAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BusinessDebitCardAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BusinessDebitCardAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BusinessDebitCard relationships(CardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessDebitCard businessDebitCard = (BusinessDebitCard) o; + return Objects.equals(this.attributes, businessDebitCard.attributes) && + Objects.equals(this.relationships, businessDebitCard.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessDebitCard {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessDebitCard is not found in the empty JSON string", BusinessDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessDebitCard + * @throws IOException if the JSON string is invalid with respect to BusinessDebitCard + */ + public static BusinessDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessDebitCard.class); + } + + /** + * Convert an instance of BusinessDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessDebitCardAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BusinessDebitCardAllOfAttributes.java new file mode 100644 index 00000000..2d6bc288 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessDebitCardAllOfAttributes.java @@ -0,0 +1,739 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.PhysicalCardStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessDebitCardAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessDebitCardAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_LAST4_DIGITS = "last4Digits"; + @SerializedName(SERIALIZED_NAME_LAST4_DIGITS) + private String last4Digits; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expirationDate"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private String expirationDate; + + public static final String SERIALIZED_NAME_SHIPPING_ADDRESS = "shippingAddress"; + @SerializedName(SERIALIZED_NAME_SHIPPING_ADDRESS) + private Address shippingAddress; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private String bin; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private PhysicalCardStatus status; + + public static final String SERIALIZED_NAME_DESIGN = "design"; + @SerializedName(SERIALIZED_NAME_DESIGN) + private String design; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_FREEZE_REASON = "freezeReason"; + @SerializedName(SERIALIZED_NAME_FREEZE_REASON) + private String freezeReason; + + public BusinessDebitCardAllOfAttributes() { + } + + public BusinessDebitCardAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BusinessDebitCardAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public BusinessDebitCardAllOfAttributes last4Digits(String last4Digits) { + + this.last4Digits = last4Digits; + return this; + } + + /** + * Get last4Digits + * @return last4Digits + **/ + @javax.annotation.Nonnull + public String getLast4Digits() { + return last4Digits; + } + + + public void setLast4Digits(String last4Digits) { + this.last4Digits = last4Digits; + } + + + public BusinessDebitCardAllOfAttributes expirationDate(String expirationDate) { + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nonnull + public String getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(String expirationDate) { + this.expirationDate = expirationDate; + } + + + public BusinessDebitCardAllOfAttributes shippingAddress(Address shippingAddress) { + + this.shippingAddress = shippingAddress; + return this; + } + + /** + * Get shippingAddress + * @return shippingAddress + **/ + @javax.annotation.Nullable + public Address getShippingAddress() { + return shippingAddress; + } + + + public void setShippingAddress(Address shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public BusinessDebitCardAllOfAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public BusinessDebitCardAllOfAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public BusinessDebitCardAllOfAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public BusinessDebitCardAllOfAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public BusinessDebitCardAllOfAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public BusinessDebitCardAllOfAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public BusinessDebitCardAllOfAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public BusinessDebitCardAllOfAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public BusinessDebitCardAllOfAttributes bin(String bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nullable + public String getBin() { + return bin; + } + + + public void setBin(String bin) { + this.bin = bin; + } + + + public BusinessDebitCardAllOfAttributes status(PhysicalCardStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public PhysicalCardStatus getStatus() { + return status; + } + + + public void setStatus(PhysicalCardStatus status) { + this.status = status; + } + + + public BusinessDebitCardAllOfAttributes design(String design) { + + this.design = design; + return this; + } + + /** + * Get design + * @return design + **/ + @javax.annotation.Nullable + public String getDesign() { + return design; + } + + + public void setDesign(String design) { + this.design = design; + } + + + public BusinessDebitCardAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public BusinessDebitCardAllOfAttributes freezeReason(String freezeReason) { + + this.freezeReason = freezeReason; + return this; + } + + /** + * Get freezeReason + * @return freezeReason + **/ + @javax.annotation.Nullable + public String getFreezeReason() { + return freezeReason; + } + + + public void setFreezeReason(String freezeReason) { + this.freezeReason = freezeReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessDebitCardAllOfAttributes businessDebitCardAllOfAttributes = (BusinessDebitCardAllOfAttributes) o; + return Objects.equals(this.createdAt, businessDebitCardAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, businessDebitCardAllOfAttributes.updatedAt) && + Objects.equals(this.last4Digits, businessDebitCardAllOfAttributes.last4Digits) && + Objects.equals(this.expirationDate, businessDebitCardAllOfAttributes.expirationDate) && + Objects.equals(this.shippingAddress, businessDebitCardAllOfAttributes.shippingAddress) && + Objects.equals(this.address, businessDebitCardAllOfAttributes.address) && + Objects.equals(this.fullName, businessDebitCardAllOfAttributes.fullName) && + Objects.equals(this.phone, businessDebitCardAllOfAttributes.phone) && + Objects.equals(this.email, businessDebitCardAllOfAttributes.email) && + Objects.equals(this.dateOfBirth, businessDebitCardAllOfAttributes.dateOfBirth) && + Objects.equals(this.nationality, businessDebitCardAllOfAttributes.nationality) && + Objects.equals(this.ssn, businessDebitCardAllOfAttributes.ssn) && + Objects.equals(this.passport, businessDebitCardAllOfAttributes.passport) && + Objects.equals(this.bin, businessDebitCardAllOfAttributes.bin) && + Objects.equals(this.status, businessDebitCardAllOfAttributes.status) && + Objects.equals(this.design, businessDebitCardAllOfAttributes.design) && + Objects.equals(this.tags, businessDebitCardAllOfAttributes.tags) && + Objects.equals(this.freezeReason, businessDebitCardAllOfAttributes.freezeReason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, last4Digits, expirationDate, shippingAddress, address, fullName, phone, email, dateOfBirth, nationality, ssn, passport, bin, status, design, tags, freezeReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessDebitCardAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" last4Digits: ").append(toIndentedString(last4Digits)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" design: ").append(toIndentedString(design)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" freezeReason: ").append(toIndentedString(freezeReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("last4Digits"); + openapiFields.add("expirationDate"); + openapiFields.add("shippingAddress"); + openapiFields.add("address"); + openapiFields.add("fullName"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("dateOfBirth"); + openapiFields.add("nationality"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("bin"); + openapiFields.add("status"); + openapiFields.add("design"); + openapiFields.add("tags"); + openapiFields.add("freezeReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("last4Digits"); + openapiRequiredFields.add("expirationDate"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessDebitCardAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessDebitCardAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessDebitCardAllOfAttributes is not found in the empty JSON string", BusinessDebitCardAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessDebitCardAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessDebitCardAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessDebitCardAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("last4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last4Digits").toString())); + } + if (!jsonObj.get("expirationDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expirationDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expirationDate").toString())); + } + // validate the optional field `shippingAddress` + if (jsonObj.get("shippingAddress") != null && !jsonObj.get("shippingAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("shippingAddress")); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("bin") != null && !jsonObj.get("bin").isJsonNull()) && !jsonObj.get("bin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bin").toString())); + } + if ((jsonObj.get("design") != null && !jsonObj.get("design").isJsonNull()) && !jsonObj.get("design").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `design` to be a primitive type in the JSON string but got `%s`", jsonObj.get("design").toString())); + } + if ((jsonObj.get("freezeReason") != null && !jsonObj.get("freezeReason").isJsonNull()) && !jsonObj.get("freezeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `freezeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("freezeReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessDebitCardAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessDebitCardAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessDebitCardAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessDebitCardAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessDebitCardAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessDebitCardAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessDebitCardAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BusinessDebitCardAllOfAttributes + */ + public static BusinessDebitCardAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessDebitCardAllOfAttributes.class); + } + + /** + * Convert an instance of BusinessDebitCardAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessNumberOfEmployees.java b/src/main/java/org/openapitools/client/model/BusinessNumberOfEmployees.java new file mode 100644 index 00000000..5865b80f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessNumberOfEmployees.java @@ -0,0 +1,78 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets businessNumberOfEmployees + */ +@JsonAdapter(BusinessNumberOfEmployees.Adapter.class) +public enum BusinessNumberOfEmployees { + + UPTO10("UpTo10"), + + BETWEEN10AND50("Between10And50"), + + BETWEEN50AND100("Between50And100"), + + BETWEEN100AND500("Between100And500"), + + OVER500("Over500"); + + private String value; + + BusinessNumberOfEmployees(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static BusinessNumberOfEmployees fromValue(String value) { + for (BusinessNumberOfEmployees b : BusinessNumberOfEmployees.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final BusinessNumberOfEmployees enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public BusinessNumberOfEmployees read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BusinessNumberOfEmployees.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessVertical.java b/src/main/java/org/openapitools/client/model/BusinessVertical.java new file mode 100644 index 00000000..4c17db8c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessVertical.java @@ -0,0 +1,128 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets businessVertical + */ +@JsonAdapter(BusinessVertical.Adapter.class) +public enum BusinessVertical { + + ADULTENTERTAINMENTDATINGORESCORTSERVICES("AdultEntertainmentDatingOrEscortServices"), + + AGRICULTUREFORESTRYFISHINGORHUNTING("AgricultureForestryFishingOrHunting"), + + ARTSENTERTAINMENTANDRECREATION("ArtsEntertainmentAndRecreation"), + + BUSINESSSUPPORTORBUILDINGSERVICES("BusinessSupportOrBuildingServices"), + + CANNABIS("Cannabis"), + + CONSTRUCTION("Construction"), + + DIRECTMARKETINGORTELEMARKETING("DirectMarketingOrTelemarketing"), + + EDUCATIONALSERVICES("EducationalServices"), + + FINANCIALSERVICESCRYPTOCURRENCY("FinancialServicesCryptocurrency"), + + FINANCIALSERVICESDEBITCOLLECTIONORCONSOLIDATION("FinancialServicesDebitCollectionOrConsolidation"), + + FINANCIALSERVICESMONEYSERVICESBUSINESSORCURRENCYEXCHANGE("FinancialServicesMoneyServicesBusinessOrCurrencyExchange"), + + FINANCIALSERVICESOTHER("FinancialServicesOther"), + + FINANCIALSERVICESPAYDAYLENDING("FinancialServicesPaydayLending"), + + GAMINGORGAMBLING("GamingOrGambling"), + + HEALTHCAREANDSOCIALASSISTANCE("HealthCareAndSocialAssistance"), + + HOSPITALITYACCOMMODATIONORFOODSERVICES("HospitalityAccommodationOrFoodServices"), + + LEGALACCOUNTINGCONSULTINGORCOMPUTERPROGRAMMING("LegalAccountingConsultingOrComputerProgramming"), + + MANUFACTURING("Manufacturing"), + + MINING("Mining"), + + NUTRACEUTICALS("Nutraceuticals"), + + PERSONALCARESERVICES("PersonalCareServices"), + + PUBLICADMINISTRATION("PublicAdministration"), + + REALESTATE("RealEstate"), + + RELIGIOUSCIVICANDSOCIALORGANIZATIONS("ReligiousCivicAndSocialOrganizations"), + + REPAIRANDMAINTENANCE("RepairAndMaintenance"), + + RETAILTRADE("RetailTrade"), + + TECHNOLOGYMEDIAORTELECOM("TechnologyMediaOrTelecom"), + + TRANSPORTATIONORWAREHOUSING("TransportationOrWarehousing"), + + UTILITIES("Utilities"), + + WHOLESALETRADE("WholesaleTrade"); + + private String value; + + BusinessVertical(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static BusinessVertical fromValue(String value) { + for (BusinessVertical b : BusinessVertical.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final BusinessVertical enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public BusinessVertical read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BusinessVertical.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessVirtualCreditCard.java b/src/main/java/org/openapitools/client/model/BusinessVirtualCreditCard.java new file mode 100644 index 00000000..14fb01d8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessVirtualCreditCard.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BusinessVirtualDebitCardAllOfAttributes; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.CardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessVirtualCreditCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessVirtualCreditCard extends Card { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BusinessVirtualDebitCardAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CardRelationships relationships; + + public BusinessVirtualCreditCard() { + this.type = this.getClass().getSimpleName(); + } + + public BusinessVirtualCreditCard attributes(BusinessVirtualDebitCardAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BusinessVirtualDebitCardAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BusinessVirtualDebitCardAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BusinessVirtualCreditCard relationships(CardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessVirtualCreditCard businessVirtualCreditCard = (BusinessVirtualCreditCard) o; + return Objects.equals(this.attributes, businessVirtualCreditCard.attributes) && + Objects.equals(this.relationships, businessVirtualCreditCard.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessVirtualCreditCard {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessVirtualCreditCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessVirtualCreditCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessVirtualCreditCard is not found in the empty JSON string", BusinessVirtualCreditCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessVirtualCreditCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessVirtualCreditCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessVirtualCreditCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessVirtualCreditCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessVirtualCreditCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessVirtualCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessVirtualCreditCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessVirtualCreditCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessVirtualCreditCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessVirtualCreditCard + * @throws IOException if the JSON string is invalid with respect to BusinessVirtualCreditCard + */ + public static BusinessVirtualCreditCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessVirtualCreditCard.class); + } + + /** + * Convert an instance of BusinessVirtualCreditCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessVirtualDebitCard.java b/src/main/java/org/openapitools/client/model/BusinessVirtualDebitCard.java new file mode 100644 index 00000000..b158334d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessVirtualDebitCard.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BusinessVirtualDebitCardAllOfAttributes; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.CardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessVirtualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessVirtualDebitCard extends Card { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private BusinessVirtualDebitCardAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CardRelationships relationships; + + public BusinessVirtualDebitCard() { + this.type = this.getClass().getSimpleName(); + } + + public BusinessVirtualDebitCard attributes(BusinessVirtualDebitCardAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public BusinessVirtualDebitCardAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(BusinessVirtualDebitCardAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public BusinessVirtualDebitCard relationships(CardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessVirtualDebitCard businessVirtualDebitCard = (BusinessVirtualDebitCard) o; + return Objects.equals(this.attributes, businessVirtualDebitCard.attributes) && + Objects.equals(this.relationships, businessVirtualDebitCard.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessVirtualDebitCard {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessVirtualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessVirtualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessVirtualDebitCard is not found in the empty JSON string", BusinessVirtualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessVirtualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessVirtualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessVirtualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessVirtualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessVirtualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessVirtualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessVirtualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessVirtualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessVirtualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessVirtualDebitCard + * @throws IOException if the JSON string is invalid with respect to BusinessVirtualDebitCard + */ + public static BusinessVirtualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessVirtualDebitCard.class); + } + + /** + * Convert an instance of BusinessVirtualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/BusinessVirtualDebitCardAllOfAttributes.java b/src/main/java/org/openapitools/client/model/BusinessVirtualDebitCardAllOfAttributes.java new file mode 100644 index 00000000..c68282cf --- /dev/null +++ b/src/main/java/org/openapitools/client/model/BusinessVirtualDebitCardAllOfAttributes.java @@ -0,0 +1,676 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.VirtualCardStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BusinessVirtualDebitCardAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BusinessVirtualDebitCardAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_LAST4_DIGITS = "last4Digits"; + @SerializedName(SERIALIZED_NAME_LAST4_DIGITS) + private String last4Digits; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expirationDate"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private String expirationDate; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private String bin; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private VirtualCardStatus status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_FREEZE_REASON = "freezeReason"; + @SerializedName(SERIALIZED_NAME_FREEZE_REASON) + private String freezeReason; + + public BusinessVirtualDebitCardAllOfAttributes() { + } + + public BusinessVirtualDebitCardAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BusinessVirtualDebitCardAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public BusinessVirtualDebitCardAllOfAttributes last4Digits(String last4Digits) { + + this.last4Digits = last4Digits; + return this; + } + + /** + * Get last4Digits + * @return last4Digits + **/ + @javax.annotation.Nonnull + public String getLast4Digits() { + return last4Digits; + } + + + public void setLast4Digits(String last4Digits) { + this.last4Digits = last4Digits; + } + + + public BusinessVirtualDebitCardAllOfAttributes expirationDate(String expirationDate) { + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nonnull + public String getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(String expirationDate) { + this.expirationDate = expirationDate; + } + + + public BusinessVirtualDebitCardAllOfAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public BusinessVirtualDebitCardAllOfAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public BusinessVirtualDebitCardAllOfAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public BusinessVirtualDebitCardAllOfAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public BusinessVirtualDebitCardAllOfAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public BusinessVirtualDebitCardAllOfAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public BusinessVirtualDebitCardAllOfAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public BusinessVirtualDebitCardAllOfAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public BusinessVirtualDebitCardAllOfAttributes bin(String bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nullable + public String getBin() { + return bin; + } + + + public void setBin(String bin) { + this.bin = bin; + } + + + public BusinessVirtualDebitCardAllOfAttributes status(VirtualCardStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public VirtualCardStatus getStatus() { + return status; + } + + + public void setStatus(VirtualCardStatus status) { + this.status = status; + } + + + public BusinessVirtualDebitCardAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public BusinessVirtualDebitCardAllOfAttributes freezeReason(String freezeReason) { + + this.freezeReason = freezeReason; + return this; + } + + /** + * Get freezeReason + * @return freezeReason + **/ + @javax.annotation.Nullable + public String getFreezeReason() { + return freezeReason; + } + + + public void setFreezeReason(String freezeReason) { + this.freezeReason = freezeReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BusinessVirtualDebitCardAllOfAttributes businessVirtualDebitCardAllOfAttributes = (BusinessVirtualDebitCardAllOfAttributes) o; + return Objects.equals(this.createdAt, businessVirtualDebitCardAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, businessVirtualDebitCardAllOfAttributes.updatedAt) && + Objects.equals(this.last4Digits, businessVirtualDebitCardAllOfAttributes.last4Digits) && + Objects.equals(this.expirationDate, businessVirtualDebitCardAllOfAttributes.expirationDate) && + Objects.equals(this.address, businessVirtualDebitCardAllOfAttributes.address) && + Objects.equals(this.fullName, businessVirtualDebitCardAllOfAttributes.fullName) && + Objects.equals(this.phone, businessVirtualDebitCardAllOfAttributes.phone) && + Objects.equals(this.email, businessVirtualDebitCardAllOfAttributes.email) && + Objects.equals(this.dateOfBirth, businessVirtualDebitCardAllOfAttributes.dateOfBirth) && + Objects.equals(this.nationality, businessVirtualDebitCardAllOfAttributes.nationality) && + Objects.equals(this.ssn, businessVirtualDebitCardAllOfAttributes.ssn) && + Objects.equals(this.passport, businessVirtualDebitCardAllOfAttributes.passport) && + Objects.equals(this.bin, businessVirtualDebitCardAllOfAttributes.bin) && + Objects.equals(this.status, businessVirtualDebitCardAllOfAttributes.status) && + Objects.equals(this.tags, businessVirtualDebitCardAllOfAttributes.tags) && + Objects.equals(this.freezeReason, businessVirtualDebitCardAllOfAttributes.freezeReason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, last4Digits, expirationDate, address, fullName, phone, email, dateOfBirth, nationality, ssn, passport, bin, status, tags, freezeReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BusinessVirtualDebitCardAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" last4Digits: ").append(toIndentedString(last4Digits)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" freezeReason: ").append(toIndentedString(freezeReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("last4Digits"); + openapiFields.add("expirationDate"); + openapiFields.add("address"); + openapiFields.add("fullName"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("dateOfBirth"); + openapiFields.add("nationality"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("bin"); + openapiFields.add("status"); + openapiFields.add("tags"); + openapiFields.add("freezeReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("last4Digits"); + openapiRequiredFields.add("expirationDate"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BusinessVirtualDebitCardAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BusinessVirtualDebitCardAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BusinessVirtualDebitCardAllOfAttributes is not found in the empty JSON string", BusinessVirtualDebitCardAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BusinessVirtualDebitCardAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BusinessVirtualDebitCardAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BusinessVirtualDebitCardAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("last4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last4Digits").toString())); + } + if (!jsonObj.get("expirationDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expirationDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expirationDate").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("bin") != null && !jsonObj.get("bin").isJsonNull()) && !jsonObj.get("bin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bin").toString())); + } + if ((jsonObj.get("freezeReason") != null && !jsonObj.get("freezeReason").isJsonNull()) && !jsonObj.get("freezeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `freezeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("freezeReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BusinessVirtualDebitCardAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BusinessVirtualDebitCardAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BusinessVirtualDebitCardAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BusinessVirtualDebitCardAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BusinessVirtualDebitCardAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BusinessVirtualDebitCardAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of BusinessVirtualDebitCardAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to BusinessVirtualDebitCardAllOfAttributes + */ + public static BusinessVirtualDebitCardAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BusinessVirtualDebitCardAllOfAttributes.class); + } + + /** + * Convert an instance of BusinessVirtualDebitCardAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Card.java b/src/main/java/org/openapitools/client/model/Card.java new file mode 100644 index 00000000..97943a03 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Card.java @@ -0,0 +1,221 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Card + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Card { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public Card() { + this.type = this.getClass().getSimpleName(); + } + + public Card type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Card id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Card card = (Card) o; + return Objects.equals(this.type, card.type) && + Objects.equals(this.id, card.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Card {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Card + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Card.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Card is not found in the empty JSON string", Card.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "businessCreditCard": + BusinessCreditCard.validateJsonElement(jsonElement); + break; + case "businessDebitCard": + BusinessDebitCard.validateJsonElement(jsonElement); + break; + case "businessVirtualCreditCard": + BusinessVirtualCreditCard.validateJsonElement(jsonElement); + break; + case "businessVirtualDebitCard": + BusinessVirtualDebitCard.validateJsonElement(jsonElement); + break; + case "individualDebitCard": + IndividualDebitCard.validateJsonElement(jsonElement); + break; + case "individualVirtualDebitCard": + IndividualVirtualDebitCard.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Card given an JSON string + * + * @param jsonString JSON string + * @return An instance of Card + * @throws IOException if the JSON string is invalid with respect to Card + */ + public static Card fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Card.class); + } + + /** + * Convert an instance of Card to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardLevelLimits.java b/src/main/java/org/openapitools/client/model/CardLevelLimits.java new file mode 100644 index 00000000..869de9e9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardLevelLimits.java @@ -0,0 +1,289 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardLevelLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardLevelLimits { + public static final String SERIALIZED_NAME_DAILY_WITHDRAWAL = "dailyWithdrawal"; + @SerializedName(SERIALIZED_NAME_DAILY_WITHDRAWAL) + private Integer dailyWithdrawal; + + public static final String SERIALIZED_NAME_DAILY_PURCHASE = "dailyPurchase"; + @SerializedName(SERIALIZED_NAME_DAILY_PURCHASE) + private Integer dailyPurchase; + + public static final String SERIALIZED_NAME_MONTHLY_WITHDRAWAL = "monthlyWithdrawal"; + @SerializedName(SERIALIZED_NAME_MONTHLY_WITHDRAWAL) + private Integer monthlyWithdrawal; + + public static final String SERIALIZED_NAME_MONTHLY_PURCHASE = "monthlyPurchase"; + @SerializedName(SERIALIZED_NAME_MONTHLY_PURCHASE) + private Integer monthlyPurchase; + + public CardLevelLimits() { + } + + public CardLevelLimits dailyWithdrawal(Integer dailyWithdrawal) { + + this.dailyWithdrawal = dailyWithdrawal; + return this; + } + + /** + * Get dailyWithdrawal + * @return dailyWithdrawal + **/ + @javax.annotation.Nullable + public Integer getDailyWithdrawal() { + return dailyWithdrawal; + } + + + public void setDailyWithdrawal(Integer dailyWithdrawal) { + this.dailyWithdrawal = dailyWithdrawal; + } + + + public CardLevelLimits dailyPurchase(Integer dailyPurchase) { + + this.dailyPurchase = dailyPurchase; + return this; + } + + /** + * Get dailyPurchase + * @return dailyPurchase + **/ + @javax.annotation.Nullable + public Integer getDailyPurchase() { + return dailyPurchase; + } + + + public void setDailyPurchase(Integer dailyPurchase) { + this.dailyPurchase = dailyPurchase; + } + + + public CardLevelLimits monthlyWithdrawal(Integer monthlyWithdrawal) { + + this.monthlyWithdrawal = monthlyWithdrawal; + return this; + } + + /** + * Get monthlyWithdrawal + * @return monthlyWithdrawal + **/ + @javax.annotation.Nullable + public Integer getMonthlyWithdrawal() { + return monthlyWithdrawal; + } + + + public void setMonthlyWithdrawal(Integer monthlyWithdrawal) { + this.monthlyWithdrawal = monthlyWithdrawal; + } + + + public CardLevelLimits monthlyPurchase(Integer monthlyPurchase) { + + this.monthlyPurchase = monthlyPurchase; + return this; + } + + /** + * Get monthlyPurchase + * @return monthlyPurchase + **/ + @javax.annotation.Nullable + public Integer getMonthlyPurchase() { + return monthlyPurchase; + } + + + public void setMonthlyPurchase(Integer monthlyPurchase) { + this.monthlyPurchase = monthlyPurchase; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardLevelLimits cardLevelLimits = (CardLevelLimits) o; + return Objects.equals(this.dailyWithdrawal, cardLevelLimits.dailyWithdrawal) && + Objects.equals(this.dailyPurchase, cardLevelLimits.dailyPurchase) && + Objects.equals(this.monthlyWithdrawal, cardLevelLimits.monthlyWithdrawal) && + Objects.equals(this.monthlyPurchase, cardLevelLimits.monthlyPurchase); + } + + @Override + public int hashCode() { + return Objects.hash(dailyWithdrawal, dailyPurchase, monthlyWithdrawal, monthlyPurchase); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardLevelLimits {\n"); + sb.append(" dailyWithdrawal: ").append(toIndentedString(dailyWithdrawal)).append("\n"); + sb.append(" dailyPurchase: ").append(toIndentedString(dailyPurchase)).append("\n"); + sb.append(" monthlyWithdrawal: ").append(toIndentedString(monthlyWithdrawal)).append("\n"); + sb.append(" monthlyPurchase: ").append(toIndentedString(monthlyPurchase)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyWithdrawal"); + openapiFields.add("dailyPurchase"); + openapiFields.add("monthlyWithdrawal"); + openapiFields.add("monthlyPurchase"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardLevelLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardLevelLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardLevelLimits is not found in the empty JSON string", CardLevelLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardLevelLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardLevelLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardLevelLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardLevelLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardLevelLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardLevelLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardLevelLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardLevelLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardLevelLimits + * @throws IOException if the JSON string is invalid with respect to CardLevelLimits + */ + public static CardLevelLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardLevelLimits.class); + } + + /** + * Convert an instance of CardLevelLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardRelationship.java b/src/main/java/org/openapitools/client/model/CardRelationship.java new file mode 100644 index 00000000..74f2001a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequestRelationshipsCardData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AuthorizationRequestRelationshipsCardData data; + + public CardRelationship() { + } + + public CardRelationship data(AuthorizationRequestRelationshipsCardData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationshipsCardData getData() { + return data; + } + + + public void setData(AuthorizationRequestRelationshipsCardData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardRelationship cardRelationship = (CardRelationship) o; + return Objects.equals(this.data, cardRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardRelationship is not found in the empty JSON string", CardRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + AuthorizationRequestRelationshipsCardData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardRelationship + * @throws IOException if the JSON string is invalid with respect to CardRelationship + */ + public static CardRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardRelationship.class); + } + + /** + * Convert an instance of CardRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardRelationships.java b/src/main/java/org/openapitools/client/model/CardRelationships.java new file mode 100644 index 00000000..14185de9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardRelationships.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CardRelationshipsAccount; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private CardRelationshipsAccount account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public CardRelationships() { + } + + public CardRelationships account(CardRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public CardRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(CardRelationshipsAccount account) { + this.account = account; + } + + + public CardRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardRelationships cardRelationships = (CardRelationships) o; + return Objects.equals(this.account, cardRelationships.account) && + Objects.equals(this.customer, cardRelationships.customer); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardRelationships is not found in the empty JSON string", CardRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + CardRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardRelationships + * @throws IOException if the JSON string is invalid with respect to CardRelationships + */ + public static CardRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardRelationships.class); + } + + /** + * Convert an instance of CardRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardRelationshipsAccount.java b/src/main/java/org/openapitools/client/model/CardRelationshipsAccount.java new file mode 100644 index 00000000..849a6610 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardRelationshipsAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyAccountRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardRelationshipsAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardRelationshipsAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CounterpartyAccountRelationshipData data; + + public CardRelationshipsAccount() { + } + + public CardRelationshipsAccount data(CounterpartyAccountRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CounterpartyAccountRelationshipData getData() { + return data; + } + + + public void setData(CounterpartyAccountRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardRelationshipsAccount cardRelationshipsAccount = (CardRelationshipsAccount) o; + return Objects.equals(this.data, cardRelationshipsAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardRelationshipsAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardRelationshipsAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardRelationshipsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardRelationshipsAccount is not found in the empty JSON string", CardRelationshipsAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardRelationshipsAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardRelationshipsAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardRelationshipsAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CounterpartyAccountRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardRelationshipsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardRelationshipsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardRelationshipsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardRelationshipsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardRelationshipsAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardRelationshipsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardRelationshipsAccount + * @throws IOException if the JSON string is invalid with respect to CardRelationshipsAccount + */ + public static CardRelationshipsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardRelationshipsAccount.class); + } + + /** + * Convert an instance of CardRelationshipsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardTransaction.java b/src/main/java/org/openapitools/client/model/CardTransaction.java new file mode 100644 index 00000000..c7c6510a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CardTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CardTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public CardTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public CardTransaction attributes(CardTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CardTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CardTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CardTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardTransaction cardTransaction = (CardTransaction) o; + return Objects.equals(this.attributes, cardTransaction.attributes) && + Objects.equals(this.relationships, cardTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardTransaction is not found in the empty JSON string", CardTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardTransaction + * @throws IOException if the JSON string is invalid with respect to CardTransaction + */ + public static CardTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardTransaction.class); + } + + /** + * Convert an instance of CardTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/CardTransactionAllOfAttributes.java new file mode 100644 index 00000000..cb841717 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardTransactionAllOfAttributes.java @@ -0,0 +1,732 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.CardVerificationData; +import org.openapitools.client.model.Merchant; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_CARD_LAST4_DIGITS = "cardLast4Digits"; + @SerializedName(SERIALIZED_NAME_CARD_LAST4_DIGITS) + private String cardLast4Digits; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_NETWORK_TRANSACTION_ID = "networkTransactionId"; + @SerializedName(SERIALIZED_NAME_NETWORK_TRANSACTION_ID) + private String networkTransactionId; + + public static final String SERIALIZED_NAME_INTERCHANGE = "interchange"; + @SerializedName(SERIALIZED_NAME_INTERCHANGE) + private String interchange; + + public static final String SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE = "internationalServiceFee"; + @SerializedName(SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE) + private Integer internationalServiceFee; + + public static final String SERIALIZED_NAME_MERCHANT = "merchant"; + @SerializedName(SERIALIZED_NAME_MERCHANT) + private Merchant merchant; + + public static final String SERIALIZED_NAME_RECURRING = "recurring"; + @SerializedName(SERIALIZED_NAME_RECURRING) + private Boolean recurring; + + public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod"; + @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD) + private String paymentMethod; + + public static final String SERIALIZED_NAME_DIGITAL_WALLET = "digitalWallet"; + @SerializedName(SERIALIZED_NAME_DIGITAL_WALLET) + private String digitalWallet; + + public static final String SERIALIZED_NAME_CARD_VERIFICATION_DATA = "cardVerificationData"; + @SerializedName(SERIALIZED_NAME_CARD_VERIFICATION_DATA) + private CardVerificationData cardVerificationData; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public CardTransactionAllOfAttributes() { + } + + public CardTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CardTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CardTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CardTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public CardTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public CardTransactionAllOfAttributes cardLast4Digits(String cardLast4Digits) { + + this.cardLast4Digits = cardLast4Digits; + return this; + } + + /** + * Get cardLast4Digits + * @return cardLast4Digits + **/ + @javax.annotation.Nonnull + public String getCardLast4Digits() { + return cardLast4Digits; + } + + + public void setCardLast4Digits(String cardLast4Digits) { + this.cardLast4Digits = cardLast4Digits; + } + + + public CardTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CardTransactionAllOfAttributes networkTransactionId(String networkTransactionId) { + + this.networkTransactionId = networkTransactionId; + return this; + } + + /** + * Get networkTransactionId + * @return networkTransactionId + **/ + @javax.annotation.Nullable + public String getNetworkTransactionId() { + return networkTransactionId; + } + + + public void setNetworkTransactionId(String networkTransactionId) { + this.networkTransactionId = networkTransactionId; + } + + + public CardTransactionAllOfAttributes interchange(String interchange) { + + this.interchange = interchange; + return this; + } + + /** + * Get interchange + * @return interchange + **/ + @javax.annotation.Nullable + public String getInterchange() { + return interchange; + } + + + public void setInterchange(String interchange) { + this.interchange = interchange; + } + + + public CardTransactionAllOfAttributes internationalServiceFee(Integer internationalServiceFee) { + + this.internationalServiceFee = internationalServiceFee; + return this; + } + + /** + * Get internationalServiceFee + * @return internationalServiceFee + **/ + @javax.annotation.Nullable + public Integer getInternationalServiceFee() { + return internationalServiceFee; + } + + + public void setInternationalServiceFee(Integer internationalServiceFee) { + this.internationalServiceFee = internationalServiceFee; + } + + + public CardTransactionAllOfAttributes merchant(Merchant merchant) { + + this.merchant = merchant; + return this; + } + + /** + * Get merchant + * @return merchant + **/ + @javax.annotation.Nonnull + public Merchant getMerchant() { + return merchant; + } + + + public void setMerchant(Merchant merchant) { + this.merchant = merchant; + } + + + public CardTransactionAllOfAttributes recurring(Boolean recurring) { + + this.recurring = recurring; + return this; + } + + /** + * Get recurring + * @return recurring + **/ + @javax.annotation.Nonnull + public Boolean getRecurring() { + return recurring; + } + + + public void setRecurring(Boolean recurring) { + this.recurring = recurring; + } + + + public CardTransactionAllOfAttributes paymentMethod(String paymentMethod) { + + this.paymentMethod = paymentMethod; + return this; + } + + /** + * Get paymentMethod + * @return paymentMethod + **/ + @javax.annotation.Nullable + public String getPaymentMethod() { + return paymentMethod; + } + + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + + public CardTransactionAllOfAttributes digitalWallet(String digitalWallet) { + + this.digitalWallet = digitalWallet; + return this; + } + + /** + * Get digitalWallet + * @return digitalWallet + **/ + @javax.annotation.Nullable + public String getDigitalWallet() { + return digitalWallet; + } + + + public void setDigitalWallet(String digitalWallet) { + this.digitalWallet = digitalWallet; + } + + + public CardTransactionAllOfAttributes cardVerificationData(CardVerificationData cardVerificationData) { + + this.cardVerificationData = cardVerificationData; + return this; + } + + /** + * Get cardVerificationData + * @return cardVerificationData + **/ + @javax.annotation.Nullable + public CardVerificationData getCardVerificationData() { + return cardVerificationData; + } + + + public void setCardVerificationData(CardVerificationData cardVerificationData) { + this.cardVerificationData = cardVerificationData; + } + + + public CardTransactionAllOfAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardTransactionAllOfAttributes cardTransactionAllOfAttributes = (CardTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, cardTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, cardTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, cardTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, cardTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, cardTransactionAllOfAttributes.summary) && + Objects.equals(this.cardLast4Digits, cardTransactionAllOfAttributes.cardLast4Digits) && + Objects.equals(this.tags, cardTransactionAllOfAttributes.tags) && + Objects.equals(this.networkTransactionId, cardTransactionAllOfAttributes.networkTransactionId) && + Objects.equals(this.interchange, cardTransactionAllOfAttributes.interchange) && + Objects.equals(this.internationalServiceFee, cardTransactionAllOfAttributes.internationalServiceFee) && + Objects.equals(this.merchant, cardTransactionAllOfAttributes.merchant) && + Objects.equals(this.recurring, cardTransactionAllOfAttributes.recurring) && + Objects.equals(this.paymentMethod, cardTransactionAllOfAttributes.paymentMethod) && + Objects.equals(this.digitalWallet, cardTransactionAllOfAttributes.digitalWallet) && + Objects.equals(this.cardVerificationData, cardTransactionAllOfAttributes.cardVerificationData) && + Objects.equals(this.cardNetwork, cardTransactionAllOfAttributes.cardNetwork); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, cardLast4Digits, tags, networkTransactionId, interchange, internationalServiceFee, merchant, recurring, paymentMethod, digitalWallet, cardVerificationData, cardNetwork); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" cardLast4Digits: ").append(toIndentedString(cardLast4Digits)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" networkTransactionId: ").append(toIndentedString(networkTransactionId)).append("\n"); + sb.append(" interchange: ").append(toIndentedString(interchange)).append("\n"); + sb.append(" internationalServiceFee: ").append(toIndentedString(internationalServiceFee)).append("\n"); + sb.append(" merchant: ").append(toIndentedString(merchant)).append("\n"); + sb.append(" recurring: ").append(toIndentedString(recurring)).append("\n"); + sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); + sb.append(" digitalWallet: ").append(toIndentedString(digitalWallet)).append("\n"); + sb.append(" cardVerificationData: ").append(toIndentedString(cardVerificationData)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("cardLast4Digits"); + openapiFields.add("tags"); + openapiFields.add("networkTransactionId"); + openapiFields.add("interchange"); + openapiFields.add("internationalServiceFee"); + openapiFields.add("merchant"); + openapiFields.add("recurring"); + openapiFields.add("paymentMethod"); + openapiFields.add("digitalWallet"); + openapiFields.add("cardVerificationData"); + openapiFields.add("cardNetwork"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("cardLast4Digits"); + openapiRequiredFields.add("merchant"); + openapiRequiredFields.add("recurring"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardTransactionAllOfAttributes is not found in the empty JSON string", CardTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("cardLast4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardLast4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardLast4Digits").toString())); + } + if ((jsonObj.get("networkTransactionId") != null && !jsonObj.get("networkTransactionId").isJsonNull()) && !jsonObj.get("networkTransactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `networkTransactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("networkTransactionId").toString())); + } + if ((jsonObj.get("interchange") != null && !jsonObj.get("interchange").isJsonNull()) && !jsonObj.get("interchange").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `interchange` to be a primitive type in the JSON string but got `%s`", jsonObj.get("interchange").toString())); + } + // validate the required field `merchant` + Merchant.validateJsonElement(jsonObj.get("merchant")); + if ((jsonObj.get("paymentMethod") != null && !jsonObj.get("paymentMethod").isJsonNull()) && !jsonObj.get("paymentMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethod").toString())); + } + if ((jsonObj.get("digitalWallet") != null && !jsonObj.get("digitalWallet").isJsonNull()) && !jsonObj.get("digitalWallet").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digitalWallet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digitalWallet").toString())); + } + // validate the optional field `cardVerificationData` + if (jsonObj.get("cardVerificationData") != null && !jsonObj.get("cardVerificationData").isJsonNull()) { + CardVerificationData.validateJsonElement(jsonObj.get("cardVerificationData")); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to CardTransactionAllOfAttributes + */ + public static CardTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of CardTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardTransactionAuthorizationRequest.java b/src/main/java/org/openapitools/client/model/CardTransactionAuthorizationRequest.java new file mode 100644 index 00000000..84d2737a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardTransactionAuthorizationRequest.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequest; +import org.openapitools.client.model.AuthorizationRequestRelationships; +import org.openapitools.client.model.CardTransactionAuthorizationRequestAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardTransactionAuthorizationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardTransactionAuthorizationRequest extends AuthorizationRequest { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CardTransactionAuthorizationRequestAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private AuthorizationRequestRelationships relationships; + + public CardTransactionAuthorizationRequest() { + this.type = this.getClass().getSimpleName(); + } + + public CardTransactionAuthorizationRequest attributes(CardTransactionAuthorizationRequestAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CardTransactionAuthorizationRequestAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CardTransactionAuthorizationRequestAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CardTransactionAuthorizationRequest relationships(AuthorizationRequestRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(AuthorizationRequestRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardTransactionAuthorizationRequest cardTransactionAuthorizationRequest = (CardTransactionAuthorizationRequest) o; + return Objects.equals(this.attributes, cardTransactionAuthorizationRequest.attributes) && + Objects.equals(this.relationships, cardTransactionAuthorizationRequest.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardTransactionAuthorizationRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardTransactionAuthorizationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardTransactionAuthorizationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardTransactionAuthorizationRequest is not found in the empty JSON string", CardTransactionAuthorizationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardTransactionAuthorizationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardTransactionAuthorizationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardTransactionAuthorizationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardTransactionAuthorizationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardTransactionAuthorizationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardTransactionAuthorizationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardTransactionAuthorizationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardTransactionAuthorizationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardTransactionAuthorizationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardTransactionAuthorizationRequest + * @throws IOException if the JSON string is invalid with respect to CardTransactionAuthorizationRequest + */ + public static CardTransactionAuthorizationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardTransactionAuthorizationRequest.class); + } + + /** + * Convert an instance of CardTransactionAuthorizationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardTransactionAuthorizationRequestAllOfAttributes.java b/src/main/java/org/openapitools/client/model/CardTransactionAuthorizationRequestAllOfAttributes.java new file mode 100644 index 00000000..7f0680c9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardTransactionAuthorizationRequestAllOfAttributes.java @@ -0,0 +1,578 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.CardVerificationData; +import org.openapitools.client.model.Merchant; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardTransactionAuthorizationRequestAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardTransactionAuthorizationRequestAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_PARTIAL_APPROVAL_ALLOWED = "partialApprovalAllowed"; + @SerializedName(SERIALIZED_NAME_PARTIAL_APPROVAL_ALLOWED) + private Boolean partialApprovalAllowed; + + public static final String SERIALIZED_NAME_APPROVED_AMOUNT = "approvedAmount"; + @SerializedName(SERIALIZED_NAME_APPROVED_AMOUNT) + private Integer approvedAmount; + + public static final String SERIALIZED_NAME_DECLINE_REASON = "declineReason"; + @SerializedName(SERIALIZED_NAME_DECLINE_REASON) + private String declineReason; + + public static final String SERIALIZED_NAME_MERCHANT = "merchant"; + @SerializedName(SERIALIZED_NAME_MERCHANT) + private Merchant merchant; + + public static final String SERIALIZED_NAME_RECURRING = "recurring"; + @SerializedName(SERIALIZED_NAME_RECURRING) + private Boolean recurring; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod"; + @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD) + private String paymentMethod; + + public static final String SERIALIZED_NAME_DIGITAL_WALLET = "digitalWallet"; + @SerializedName(SERIALIZED_NAME_DIGITAL_WALLET) + private String digitalWallet; + + public static final String SERIALIZED_NAME_CARD_VERIFICATION_DATA = "cardVerificationData"; + @SerializedName(SERIALIZED_NAME_CARD_VERIFICATION_DATA) + private CardVerificationData cardVerificationData; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public CardTransactionAuthorizationRequestAllOfAttributes() { + } + + public CardTransactionAuthorizationRequestAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes partialApprovalAllowed(Boolean partialApprovalAllowed) { + + this.partialApprovalAllowed = partialApprovalAllowed; + return this; + } + + /** + * Get partialApprovalAllowed + * @return partialApprovalAllowed + **/ + @javax.annotation.Nonnull + public Boolean getPartialApprovalAllowed() { + return partialApprovalAllowed; + } + + + public void setPartialApprovalAllowed(Boolean partialApprovalAllowed) { + this.partialApprovalAllowed = partialApprovalAllowed; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes approvedAmount(Integer approvedAmount) { + + this.approvedAmount = approvedAmount; + return this; + } + + /** + * Get approvedAmount + * @return approvedAmount + **/ + @javax.annotation.Nullable + public Integer getApprovedAmount() { + return approvedAmount; + } + + + public void setApprovedAmount(Integer approvedAmount) { + this.approvedAmount = approvedAmount; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes declineReason(String declineReason) { + + this.declineReason = declineReason; + return this; + } + + /** + * Get declineReason + * @return declineReason + **/ + @javax.annotation.Nullable + public String getDeclineReason() { + return declineReason; + } + + + public void setDeclineReason(String declineReason) { + this.declineReason = declineReason; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes merchant(Merchant merchant) { + + this.merchant = merchant; + return this; + } + + /** + * Get merchant + * @return merchant + **/ + @javax.annotation.Nonnull + public Merchant getMerchant() { + return merchant; + } + + + public void setMerchant(Merchant merchant) { + this.merchant = merchant; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes recurring(Boolean recurring) { + + this.recurring = recurring; + return this; + } + + /** + * Get recurring + * @return recurring + **/ + @javax.annotation.Nonnull + public Boolean getRecurring() { + return recurring; + } + + + public void setRecurring(Boolean recurring) { + this.recurring = recurring; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes paymentMethod(String paymentMethod) { + + this.paymentMethod = paymentMethod; + return this; + } + + /** + * Get paymentMethod + * @return paymentMethod + **/ + @javax.annotation.Nullable + public String getPaymentMethod() { + return paymentMethod; + } + + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes digitalWallet(String digitalWallet) { + + this.digitalWallet = digitalWallet; + return this; + } + + /** + * Get digitalWallet + * @return digitalWallet + **/ + @javax.annotation.Nullable + public String getDigitalWallet() { + return digitalWallet; + } + + + public void setDigitalWallet(String digitalWallet) { + this.digitalWallet = digitalWallet; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes cardVerificationData(CardVerificationData cardVerificationData) { + + this.cardVerificationData = cardVerificationData; + return this; + } + + /** + * Get cardVerificationData + * @return cardVerificationData + **/ + @javax.annotation.Nullable + public CardVerificationData getCardVerificationData() { + return cardVerificationData; + } + + + public void setCardVerificationData(CardVerificationData cardVerificationData) { + this.cardVerificationData = cardVerificationData; + } + + + public CardTransactionAuthorizationRequestAllOfAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardTransactionAuthorizationRequestAllOfAttributes cardTransactionAuthorizationRequestAllOfAttributes = (CardTransactionAuthorizationRequestAllOfAttributes) o; + return Objects.equals(this.createdAt, cardTransactionAuthorizationRequestAllOfAttributes.createdAt) && + Objects.equals(this.amount, cardTransactionAuthorizationRequestAllOfAttributes.amount) && + Objects.equals(this.status, cardTransactionAuthorizationRequestAllOfAttributes.status) && + Objects.equals(this.partialApprovalAllowed, cardTransactionAuthorizationRequestAllOfAttributes.partialApprovalAllowed) && + Objects.equals(this.approvedAmount, cardTransactionAuthorizationRequestAllOfAttributes.approvedAmount) && + Objects.equals(this.declineReason, cardTransactionAuthorizationRequestAllOfAttributes.declineReason) && + Objects.equals(this.merchant, cardTransactionAuthorizationRequestAllOfAttributes.merchant) && + Objects.equals(this.recurring, cardTransactionAuthorizationRequestAllOfAttributes.recurring) && + Objects.equals(this.tags, cardTransactionAuthorizationRequestAllOfAttributes.tags) && + Objects.equals(this.paymentMethod, cardTransactionAuthorizationRequestAllOfAttributes.paymentMethod) && + Objects.equals(this.digitalWallet, cardTransactionAuthorizationRequestAllOfAttributes.digitalWallet) && + Objects.equals(this.cardVerificationData, cardTransactionAuthorizationRequestAllOfAttributes.cardVerificationData) && + Objects.equals(this.cardNetwork, cardTransactionAuthorizationRequestAllOfAttributes.cardNetwork); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, status, partialApprovalAllowed, approvedAmount, declineReason, merchant, recurring, tags, paymentMethod, digitalWallet, cardVerificationData, cardNetwork); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardTransactionAuthorizationRequestAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" partialApprovalAllowed: ").append(toIndentedString(partialApprovalAllowed)).append("\n"); + sb.append(" approvedAmount: ").append(toIndentedString(approvedAmount)).append("\n"); + sb.append(" declineReason: ").append(toIndentedString(declineReason)).append("\n"); + sb.append(" merchant: ").append(toIndentedString(merchant)).append("\n"); + sb.append(" recurring: ").append(toIndentedString(recurring)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); + sb.append(" digitalWallet: ").append(toIndentedString(digitalWallet)).append("\n"); + sb.append(" cardVerificationData: ").append(toIndentedString(cardVerificationData)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("status"); + openapiFields.add("partialApprovalAllowed"); + openapiFields.add("approvedAmount"); + openapiFields.add("declineReason"); + openapiFields.add("merchant"); + openapiFields.add("recurring"); + openapiFields.add("tags"); + openapiFields.add("paymentMethod"); + openapiFields.add("digitalWallet"); + openapiFields.add("cardVerificationData"); + openapiFields.add("cardNetwork"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("partialApprovalAllowed"); + openapiRequiredFields.add("merchant"); + openapiRequiredFields.add("recurring"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardTransactionAuthorizationRequestAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardTransactionAuthorizationRequestAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardTransactionAuthorizationRequestAllOfAttributes is not found in the empty JSON string", CardTransactionAuthorizationRequestAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardTransactionAuthorizationRequestAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardTransactionAuthorizationRequestAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardTransactionAuthorizationRequestAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("declineReason") != null && !jsonObj.get("declineReason").isJsonNull()) && !jsonObj.get("declineReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `declineReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("declineReason").toString())); + } + // validate the required field `merchant` + Merchant.validateJsonElement(jsonObj.get("merchant")); + if ((jsonObj.get("paymentMethod") != null && !jsonObj.get("paymentMethod").isJsonNull()) && !jsonObj.get("paymentMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethod").toString())); + } + if ((jsonObj.get("digitalWallet") != null && !jsonObj.get("digitalWallet").isJsonNull()) && !jsonObj.get("digitalWallet").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digitalWallet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digitalWallet").toString())); + } + // validate the optional field `cardVerificationData` + if (jsonObj.get("cardVerificationData") != null && !jsonObj.get("cardVerificationData").isJsonNull()) { + CardVerificationData.validateJsonElement(jsonObj.get("cardVerificationData")); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardTransactionAuthorizationRequestAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardTransactionAuthorizationRequestAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardTransactionAuthorizationRequestAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardTransactionAuthorizationRequestAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardTransactionAuthorizationRequestAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardTransactionAuthorizationRequestAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardTransactionAuthorizationRequestAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to CardTransactionAuthorizationRequestAllOfAttributes + */ + public static CardTransactionAuthorizationRequestAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardTransactionAuthorizationRequestAllOfAttributes.class); + } + + /** + * Convert an instance of CardTransactionAuthorizationRequestAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CardVerificationData.java b/src/main/java/org/openapitools/client/model/CardVerificationData.java new file mode 100644 index 00000000..67821e46 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CardVerificationData.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CardVerificationData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CardVerificationData { + public static final String SERIALIZED_NAME_VERIFICATION_METHOD = "verificationMethod"; + @SerializedName(SERIALIZED_NAME_VERIFICATION_METHOD) + private String verificationMethod; + + public CardVerificationData() { + } + + public CardVerificationData verificationMethod(String verificationMethod) { + + this.verificationMethod = verificationMethod; + return this; + } + + /** + * Get verificationMethod + * @return verificationMethod + **/ + @javax.annotation.Nonnull + public String getVerificationMethod() { + return verificationMethod; + } + + + public void setVerificationMethod(String verificationMethod) { + this.verificationMethod = verificationMethod; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardVerificationData cardVerificationData = (CardVerificationData) o; + return Objects.equals(this.verificationMethod, cardVerificationData.verificationMethod); + } + + @Override + public int hashCode() { + return Objects.hash(verificationMethod); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardVerificationData {\n"); + sb.append(" verificationMethod: ").append(toIndentedString(verificationMethod)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("verificationMethod"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("verificationMethod"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CardVerificationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CardVerificationData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CardVerificationData is not found in the empty JSON string", CardVerificationData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CardVerificationData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CardVerificationData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CardVerificationData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("verificationMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `verificationMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verificationMethod").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CardVerificationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CardVerificationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CardVerificationData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CardVerificationData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CardVerificationData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CardVerificationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CardVerificationData + * @throws IOException if the JSON string is invalid with respect to CardVerificationData + */ + public static CardVerificationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CardVerificationData.class); + } + + /** + * Convert an instance of CardVerificationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CashDepositTransaction.java b/src/main/java/org/openapitools/client/model/CashDepositTransaction.java new file mode 100644 index 00000000..09695e5d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CashDepositTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CashDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CashDepositTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CashDepositTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CashDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public CashDepositTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public CashDepositTransaction attributes(CashDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CashDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CashDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CashDepositTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashDepositTransaction cashDepositTransaction = (CashDepositTransaction) o; + return Objects.equals(this.attributes, cashDepositTransaction.attributes) && + Objects.equals(this.relationships, cashDepositTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashDepositTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CashDepositTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CashDepositTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CashDepositTransaction is not found in the empty JSON string", CashDepositTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CashDepositTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CashDepositTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CashDepositTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CashDepositTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CashDepositTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CashDepositTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CashDepositTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CashDepositTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CashDepositTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashDepositTransaction + * @throws IOException if the JSON string is invalid with respect to CashDepositTransaction + */ + public static CashDepositTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CashDepositTransaction.class); + } + + /** + * Convert an instance of CashDepositTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CashDepositTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/CashDepositTransactionAllOfAttributes.java new file mode 100644 index 00000000..9ed17f61 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CashDepositTransactionAllOfAttributes.java @@ -0,0 +1,440 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CashDepositTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CashDepositTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_RECURRING = "recurring"; + @SerializedName(SERIALIZED_NAME_RECURRING) + private Boolean recurring; + + public CashDepositTransactionAllOfAttributes() { + } + + public CashDepositTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CashDepositTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CashDepositTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CashDepositTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public CashDepositTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public CashDepositTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CashDepositTransactionAllOfAttributes recurring(Boolean recurring) { + + this.recurring = recurring; + return this; + } + + /** + * Get recurring + * @return recurring + **/ + @javax.annotation.Nonnull + public Boolean getRecurring() { + return recurring; + } + + + public void setRecurring(Boolean recurring) { + this.recurring = recurring; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashDepositTransactionAllOfAttributes cashDepositTransactionAllOfAttributes = (CashDepositTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, cashDepositTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, cashDepositTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, cashDepositTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, cashDepositTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, cashDepositTransactionAllOfAttributes.summary) && + Objects.equals(this.tags, cashDepositTransactionAllOfAttributes.tags) && + Objects.equals(this.recurring, cashDepositTransactionAllOfAttributes.recurring); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, tags, recurring); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashDepositTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" recurring: ").append(toIndentedString(recurring)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("tags"); + openapiFields.add("recurring"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("recurring"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CashDepositTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CashDepositTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CashDepositTransactionAllOfAttributes is not found in the empty JSON string", CashDepositTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CashDepositTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CashDepositTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CashDepositTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CashDepositTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CashDepositTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CashDepositTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CashDepositTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CashDepositTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CashDepositTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashDepositTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to CashDepositTransactionAllOfAttributes + */ + public static CashDepositTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CashDepositTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of CashDepositTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CashFlow.java b/src/main/java/org/openapitools/client/model/CashFlow.java new file mode 100644 index 00000000..05e1688e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CashFlow.java @@ -0,0 +1,72 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets cashFlow + */ +@JsonAdapter(CashFlow.Adapter.class) +public enum CashFlow { + + UNPREDICTABLE("Unpredictable"), + + PREDICTABLE("Predictable"); + + private String value; + + CashFlow(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CashFlow fromValue(String value) { + for (CashFlow b : CashFlow.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CashFlow enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CashFlow read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CashFlow.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/ChargebackRelationship.java b/src/main/java/org/openapitools/client/model/ChargebackRelationship.java new file mode 100644 index 00000000..19b4b4a7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ChargebackRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ChargebackRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ChargebackRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ChargebackRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ChargebackRelationshipData data; + + public ChargebackRelationship() { + } + + public ChargebackRelationship data(ChargebackRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ChargebackRelationshipData getData() { + return data; + } + + + public void setData(ChargebackRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChargebackRelationship chargebackRelationship = (ChargebackRelationship) o; + return Objects.equals(this.data, chargebackRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChargebackRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChargebackRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChargebackRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChargebackRelationship is not found in the empty JSON string", ChargebackRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChargebackRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChargebackRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChargebackRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ChargebackRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChargebackRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChargebackRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChargebackRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChargebackRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChargebackRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChargebackRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChargebackRelationship + * @throws IOException if the JSON string is invalid with respect to ChargebackRelationship + */ + public static ChargebackRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChargebackRelationship.class); + } + + /** + * Convert an instance of ChargebackRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ChargebackRelationshipData.java b/src/main/java/org/openapitools/client/model/ChargebackRelationshipData.java new file mode 100644 index 00000000..a087a6da --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ChargebackRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ChargebackRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ChargebackRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "chargeback"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ChargebackRelationshipData() { + } + + public ChargebackRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ChargebackRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChargebackRelationshipData chargebackRelationshipData = (ChargebackRelationshipData) o; + return Objects.equals(this.type, chargebackRelationshipData.type) && + Objects.equals(this.id, chargebackRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChargebackRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChargebackRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChargebackRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChargebackRelationshipData is not found in the empty JSON string", ChargebackRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChargebackRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChargebackRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChargebackRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChargebackRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChargebackRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChargebackRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChargebackRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChargebackRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChargebackRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChargebackRelationshipData + * @throws IOException if the JSON string is invalid with respect to ChargebackRelationshipData + */ + public static ChargebackRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChargebackRelationshipData.class); + } + + /** + * Convert an instance of ChargebackRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ChargebackTransaction.java b/src/main/java/org/openapitools/client/model/ChargebackTransaction.java new file mode 100644 index 00000000..d0b7cc3a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ChargebackTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ChargebackTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ChargebackTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ChargebackTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ChargebackTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ChargebackTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ChargebackTransaction attributes(ChargebackTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ChargebackTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ChargebackTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ChargebackTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChargebackTransaction chargebackTransaction = (ChargebackTransaction) o; + return Objects.equals(this.attributes, chargebackTransaction.attributes) && + Objects.equals(this.relationships, chargebackTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChargebackTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChargebackTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChargebackTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChargebackTransaction is not found in the empty JSON string", ChargebackTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChargebackTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChargebackTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChargebackTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChargebackTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChargebackTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChargebackTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChargebackTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChargebackTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChargebackTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChargebackTransaction + * @throws IOException if the JSON string is invalid with respect to ChargebackTransaction + */ + public static ChargebackTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChargebackTransaction.class); + } + + /** + * Convert an instance of ChargebackTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ChargebackTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ChargebackTransactionAllOfAttributes.java new file mode 100644 index 00000000..b23dbc67 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ChargebackTransactionAllOfAttributes.java @@ -0,0 +1,444 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ChargebackTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ChargebackTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ChargebackTransactionAllOfAttributes() { + } + + public ChargebackTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ChargebackTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ChargebackTransactionAllOfAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public ChargebackTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ChargebackTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ChargebackTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ChargebackTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChargebackTransactionAllOfAttributes chargebackTransactionAllOfAttributes = (ChargebackTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, chargebackTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, chargebackTransactionAllOfAttributes.direction) && + Objects.equals(this.counterparty, chargebackTransactionAllOfAttributes.counterparty) && + Objects.equals(this.amount, chargebackTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, chargebackTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, chargebackTransactionAllOfAttributes.summary) && + Objects.equals(this.tags, chargebackTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, counterparty, amount, balance, summary, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChargebackTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("counterparty"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChargebackTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChargebackTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChargebackTransactionAllOfAttributes is not found in the empty JSON string", ChargebackTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChargebackTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChargebackTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChargebackTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChargebackTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChargebackTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChargebackTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChargebackTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChargebackTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChargebackTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChargebackTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ChargebackTransactionAllOfAttributes + */ + public static ChargebackTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChargebackTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ChargebackTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDeposit.java b/src/main/java/org/openapitools/client/model/CheckDeposit.java new file mode 100644 index 00000000..0d0b5004 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDeposit.java @@ -0,0 +1,357 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositAttributes; +import org.openapitools.client.model.CheckDepositRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDeposit + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDeposit { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CHECKDEPOSIT("checkDeposit"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CheckDepositRelationships relationships; + + public CheckDeposit() { + } + + public CheckDeposit type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CheckDeposit id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public CheckDeposit attributes(CheckDepositAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositAttributes attributes) { + this.attributes = attributes; + } + + + public CheckDeposit relationships(CheckDepositRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CheckDepositRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CheckDepositRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDeposit checkDeposit = (CheckDeposit) o; + return Objects.equals(this.type, checkDeposit.type) && + Objects.equals(this.id, checkDeposit.id) && + Objects.equals(this.attributes, checkDeposit.attributes) && + Objects.equals(this.relationships, checkDeposit.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDeposit {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDeposit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDeposit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDeposit is not found in the empty JSON string", CheckDeposit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDeposit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDeposit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDeposit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + CheckDepositAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CheckDepositRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDeposit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDeposit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDeposit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDeposit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDeposit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDeposit given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDeposit + * @throws IOException if the JSON string is invalid with respect to CheckDeposit + */ + public static CheckDeposit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDeposit.class); + } + + /** + * Convert an instance of CheckDeposit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositAttributes.java b/src/main/java/org/openapitools/client/model/CheckDepositAttributes.java new file mode 100644 index 00000000..c4dc6da0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositAttributes.java @@ -0,0 +1,711 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Counterparty2; +import org.openapitools.client.model.StatusEvent; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_SETTLEMENT_DATE = "settlementDate"; + @SerializedName(SERIALIZED_NAME_SETTLEMENT_DATE) + private LocalDate settlementDate; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AWAITINGIMAGES("AwaitingImages"), + + AWAITINGFRONTIMAGE("AwaitingFrontImage"), + + AWAITINGBACKIMAGE("AwaitingBackImage"), + + PENDING("Pending"), + + PENDINGREVIEW("PendingReview"), + + AWAITINGCUSTOMERCONFIRMATION("AwaitingCustomerConfirmation"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_STATUS_CREATED_AT = "statusCreatedAt"; + @SerializedName(SERIALIZED_NAME_STATUS_CREATED_AT) + private OffsetDateTime statusCreatedAt; + + public static final String SERIALIZED_NAME_STATUS_SET_BY = "statusSetBy"; + @SerializedName(SERIALIZED_NAME_STATUS_SET_BY) + private String statusSetBy; + + public static final String SERIALIZED_NAME_STATUS_HISTORY = "statusHistory"; + @SerializedName(SERIALIZED_NAME_STATUS_HISTORY) + private List statusHistory; + + public static final String SERIALIZED_NAME_REASON_TEXT = "reasonText"; + @SerializedName(SERIALIZED_NAME_REASON_TEXT) + private String reasonText; + + public static final String SERIALIZED_NAME_CHECK_NUMBER = "checkNumber"; + @SerializedName(SERIALIZED_NAME_CHECK_NUMBER) + private String checkNumber; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + @SerializedName(SERIALIZED_NAME_VENDOR) + private String vendor; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty2 counterparty; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CheckDepositAttributes() { + } + + public CheckDepositAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CheckDepositAttributes settlementDate(LocalDate settlementDate) { + + this.settlementDate = settlementDate; + return this; + } + + /** + * Get settlementDate + * @return settlementDate + **/ + @javax.annotation.Nullable + public LocalDate getSettlementDate() { + return settlementDate; + } + + + public void setSettlementDate(LocalDate settlementDate) { + this.settlementDate = settlementDate; + } + + + public CheckDepositAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CheckDepositAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CheckDepositAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public CheckDepositAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public CheckDepositAttributes statusCreatedAt(OffsetDateTime statusCreatedAt) { + + this.statusCreatedAt = statusCreatedAt; + return this; + } + + /** + * Get statusCreatedAt + * @return statusCreatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getStatusCreatedAt() { + return statusCreatedAt; + } + + + public void setStatusCreatedAt(OffsetDateTime statusCreatedAt) { + this.statusCreatedAt = statusCreatedAt; + } + + + public CheckDepositAttributes statusSetBy(String statusSetBy) { + + this.statusSetBy = statusSetBy; + return this; + } + + /** + * Get statusSetBy + * @return statusSetBy + **/ + @javax.annotation.Nullable + public String getStatusSetBy() { + return statusSetBy; + } + + + public void setStatusSetBy(String statusSetBy) { + this.statusSetBy = statusSetBy; + } + + + public CheckDepositAttributes statusHistory(List statusHistory) { + + this.statusHistory = statusHistory; + return this; + } + + public CheckDepositAttributes addStatusHistoryItem(StatusEvent statusHistoryItem) { + if (this.statusHistory == null) { + this.statusHistory = new ArrayList<>(); + } + this.statusHistory.add(statusHistoryItem); + return this; + } + + /** + * Get statusHistory + * @return statusHistory + **/ + @javax.annotation.Nullable + public List getStatusHistory() { + return statusHistory; + } + + + public void setStatusHistory(List statusHistory) { + this.statusHistory = statusHistory; + } + + + public CheckDepositAttributes reasonText(String reasonText) { + + this.reasonText = reasonText; + return this; + } + + /** + * Get reasonText + * @return reasonText + **/ + @javax.annotation.Nullable + public String getReasonText() { + return reasonText; + } + + + public void setReasonText(String reasonText) { + this.reasonText = reasonText; + } + + + public CheckDepositAttributes checkNumber(String checkNumber) { + + this.checkNumber = checkNumber; + return this; + } + + /** + * Get checkNumber + * @return checkNumber + **/ + @javax.annotation.Nullable + public String getCheckNumber() { + return checkNumber; + } + + + public void setCheckNumber(String checkNumber) { + this.checkNumber = checkNumber; + } + + + public CheckDepositAttributes vendor(String vendor) { + + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * @return vendor + **/ + @javax.annotation.Nullable + public String getVendor() { + return vendor; + } + + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + + public CheckDepositAttributes counterparty(Counterparty2 counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public Counterparty2 getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty2 counterparty) { + this.counterparty = counterparty; + } + + + public CheckDepositAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositAttributes checkDepositAttributes = (CheckDepositAttributes) o; + return Objects.equals(this.createdAt, checkDepositAttributes.createdAt) && + Objects.equals(this.settlementDate, checkDepositAttributes.settlementDate) && + Objects.equals(this.amount, checkDepositAttributes.amount) && + Objects.equals(this.description, checkDepositAttributes.description) && + Objects.equals(this.status, checkDepositAttributes.status) && + Objects.equals(this.reason, checkDepositAttributes.reason) && + Objects.equals(this.statusCreatedAt, checkDepositAttributes.statusCreatedAt) && + Objects.equals(this.statusSetBy, checkDepositAttributes.statusSetBy) && + Objects.equals(this.statusHistory, checkDepositAttributes.statusHistory) && + Objects.equals(this.reasonText, checkDepositAttributes.reasonText) && + Objects.equals(this.checkNumber, checkDepositAttributes.checkNumber) && + Objects.equals(this.vendor, checkDepositAttributes.vendor) && + Objects.equals(this.counterparty, checkDepositAttributes.counterparty) && + Objects.equals(this.tags, checkDepositAttributes.tags); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, settlementDate, amount, description, status, reason, statusCreatedAt, statusSetBy, statusHistory, reasonText, checkNumber, vendor, counterparty, tags); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" settlementDate: ").append(toIndentedString(settlementDate)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" statusCreatedAt: ").append(toIndentedString(statusCreatedAt)).append("\n"); + sb.append(" statusSetBy: ").append(toIndentedString(statusSetBy)).append("\n"); + sb.append(" statusHistory: ").append(toIndentedString(statusHistory)).append("\n"); + sb.append(" reasonText: ").append(toIndentedString(reasonText)).append("\n"); + sb.append(" checkNumber: ").append(toIndentedString(checkNumber)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("settlementDate"); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("status"); + openapiFields.add("reason"); + openapiFields.add("statusCreatedAt"); + openapiFields.add("statusSetBy"); + openapiFields.add("statusHistory"); + openapiFields.add("reasonText"); + openapiFields.add("checkNumber"); + openapiFields.add("vendor"); + openapiFields.add("counterparty"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositAttributes is not found in the empty JSON string", CheckDepositAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("statusSetBy") != null && !jsonObj.get("statusSetBy").isJsonNull()) && !jsonObj.get("statusSetBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `statusSetBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("statusSetBy").toString())); + } + if (jsonObj.get("statusHistory") != null && !jsonObj.get("statusHistory").isJsonNull()) { + JsonArray jsonArraystatusHistory = jsonObj.getAsJsonArray("statusHistory"); + if (jsonArraystatusHistory != null) { + // ensure the json data is an array + if (!jsonObj.get("statusHistory").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `statusHistory` to be an array in the JSON string but got `%s`", jsonObj.get("statusHistory").toString())); + } + + // validate the optional field `statusHistory` (array) + for (int i = 0; i < jsonArraystatusHistory.size(); i++) { + StatusEvent.validateJsonElement(jsonArraystatusHistory.get(i)); + }; + } + } + if ((jsonObj.get("reasonText") != null && !jsonObj.get("reasonText").isJsonNull()) && !jsonObj.get("reasonText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reasonText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasonText").toString())); + } + if ((jsonObj.get("checkNumber") != null && !jsonObj.get("checkNumber").isJsonNull()) && !jsonObj.get("checkNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `checkNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("checkNumber").toString())); + } + if ((jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) && !jsonObj.get("vendor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vendor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vendor").toString())); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + Counterparty2.validateJsonElement(jsonObj.get("counterparty")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositAttributes + * @throws IOException if the JSON string is invalid with respect to CheckDepositAttributes + */ + public static CheckDepositAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositAttributes.class); + } + + /** + * Convert an instance of CheckDepositAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositRelationship.java b/src/main/java/org/openapitools/client/model/CheckDepositRelationship.java new file mode 100644 index 00000000..c342f0ea --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CheckDepositRelationshipData data; + + public CheckDepositRelationship() { + } + + public CheckDepositRelationship data(CheckDepositRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CheckDepositRelationshipData getData() { + return data; + } + + + public void setData(CheckDepositRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositRelationship checkDepositRelationship = (CheckDepositRelationship) o; + return Objects.equals(this.data, checkDepositRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositRelationship is not found in the empty JSON string", CheckDepositRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CheckDepositRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositRelationship + * @throws IOException if the JSON string is invalid with respect to CheckDepositRelationship + */ + public static CheckDepositRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositRelationship.class); + } + + /** + * Convert an instance of CheckDepositRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositRelationshipData.java b/src/main/java/org/openapitools/client/model/CheckDepositRelationshipData.java new file mode 100644 index 00000000..3b1adf97 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "checkDeposit"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public CheckDepositRelationshipData() { + } + + public CheckDepositRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CheckDepositRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositRelationshipData checkDepositRelationshipData = (CheckDepositRelationshipData) o; + return Objects.equals(this.type, checkDepositRelationshipData.type) && + Objects.equals(this.id, checkDepositRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositRelationshipData is not found in the empty JSON string", CheckDepositRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositRelationshipData + * @throws IOException if the JSON string is invalid with respect to CheckDepositRelationshipData + */ + public static CheckDepositRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositRelationshipData.class); + } + + /** + * Convert an instance of CheckDepositRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositRelationships.java b/src/main/java/org/openapitools/client/model/CheckDepositRelationships.java new file mode 100644 index 00000000..62960fd6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositRelationships.java @@ -0,0 +1,315 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositRelationshipsAccount; +import org.openapitools.client.model.OrgRelationship; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransaction; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositRelationships { + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private OrgRelationship org; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private CheckDepositRelationshipsAccount account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + @SerializedName(SERIALIZED_NAME_TRANSACTION) + private ReceivedPaymentRelationshipsReceivePaymentTransaction transaction; + + public CheckDepositRelationships() { + } + + public CheckDepositRelationships org(OrgRelationship org) { + + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @javax.annotation.Nullable + public OrgRelationship getOrg() { + return org; + } + + + public void setOrg(OrgRelationship org) { + this.org = org; + } + + + public CheckDepositRelationships account(CheckDepositRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public CheckDepositRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(CheckDepositRelationshipsAccount account) { + this.account = account; + } + + + public CheckDepositRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + public CheckDepositRelationships transaction(ReceivedPaymentRelationshipsReceivePaymentTransaction transaction) { + + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * @return transaction + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsReceivePaymentTransaction getTransaction() { + return transaction; + } + + + public void setTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction transaction) { + this.transaction = transaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositRelationships checkDepositRelationships = (CheckDepositRelationships) o; + return Objects.equals(this.org, checkDepositRelationships.org) && + Objects.equals(this.account, checkDepositRelationships.account) && + Objects.equals(this.customer, checkDepositRelationships.customer) && + Objects.equals(this.transaction, checkDepositRelationships.transaction); + } + + @Override + public int hashCode() { + return Objects.hash(org, account, customer, transaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositRelationships {\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("org"); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("transaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositRelationships is not found in the empty JSON string", CheckDepositRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `org` + if (jsonObj.get("org") != null && !jsonObj.get("org").isJsonNull()) { + OrgRelationship.validateJsonElement(jsonObj.get("org")); + } + // validate the required field `account` + CheckDepositRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `transaction` + if (jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) { + ReceivedPaymentRelationshipsReceivePaymentTransaction.validateJsonElement(jsonObj.get("transaction")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositRelationships + * @throws IOException if the JSON string is invalid with respect to CheckDepositRelationships + */ + public static CheckDepositRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositRelationships.class); + } + + /** + * Convert an instance of CheckDepositRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositRelationshipsAccount.java b/src/main/java/org/openapitools/client/model/CheckDepositRelationshipsAccount.java new file mode 100644 index 00000000..49998871 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositRelationshipsAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositRelationshipsAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositRelationshipsAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositRelationshipsAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CheckDepositRelationshipsAccountData data; + + public CheckDepositRelationshipsAccount() { + } + + public CheckDepositRelationshipsAccount data(CheckDepositRelationshipsAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CheckDepositRelationshipsAccountData getData() { + return data; + } + + + public void setData(CheckDepositRelationshipsAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositRelationshipsAccount checkDepositRelationshipsAccount = (CheckDepositRelationshipsAccount) o; + return Objects.equals(this.data, checkDepositRelationshipsAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositRelationshipsAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositRelationshipsAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositRelationshipsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositRelationshipsAccount is not found in the empty JSON string", CheckDepositRelationshipsAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositRelationshipsAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositRelationshipsAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositRelationshipsAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CheckDepositRelationshipsAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositRelationshipsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositRelationshipsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositRelationshipsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositRelationshipsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositRelationshipsAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositRelationshipsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositRelationshipsAccount + * @throws IOException if the JSON string is invalid with respect to CheckDepositRelationshipsAccount + */ + public static CheckDepositRelationshipsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositRelationshipsAccount.class); + } + + /** + * Convert an instance of CheckDepositRelationshipsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositRelationshipsAccountData.java b/src/main/java/org/openapitools/client/model/CheckDepositRelationshipsAccountData.java new file mode 100644 index 00000000..05fdac1d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositRelationshipsAccountData.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositRelationshipsAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositRelationshipsAccountData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"), + + DEPOSITACCOUNT("depositAccount"), + + BATCHACCOUNT("batchAccount"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public CheckDepositRelationshipsAccountData() { + } + + public CheckDepositRelationshipsAccountData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CheckDepositRelationshipsAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositRelationshipsAccountData checkDepositRelationshipsAccountData = (CheckDepositRelationshipsAccountData) o; + return Objects.equals(this.type, checkDepositRelationshipsAccountData.type) && + Objects.equals(this.id, checkDepositRelationshipsAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositRelationshipsAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositRelationshipsAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositRelationshipsAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositRelationshipsAccountData is not found in the empty JSON string", CheckDepositRelationshipsAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositRelationshipsAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositRelationshipsAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositRelationshipsAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositRelationshipsAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositRelationshipsAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositRelationshipsAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositRelationshipsAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositRelationshipsAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositRelationshipsAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositRelationshipsAccountData + * @throws IOException if the JSON string is invalid with respect to CheckDepositRelationshipsAccountData + */ + public static CheckDepositRelationshipsAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositRelationshipsAccountData.class); + } + + /** + * Convert an instance of CheckDepositRelationshipsAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositStatus.java b/src/main/java/org/openapitools/client/model/CheckDepositStatus.java new file mode 100644 index 00000000..b4ac5e09 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositStatus.java @@ -0,0 +1,90 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets checkDepositStatus + */ +@JsonAdapter(CheckDepositStatus.Adapter.class) +public enum CheckDepositStatus { + + AWAITINGIMAGES("AwaitingImages"), + + AWAITINGFRONTIMAGE("AwaitingFrontImage"), + + AWAITINGBACKIMAGE("AwaitingBackImage"), + + AWAITINGCUSTOMERCONFIRMATION("AwaitingCustomerConfirmation"), + + PENDING("Pending"), + + PENDINGREVIEW("PendingReview"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"); + + private String value; + + CheckDepositStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CheckDepositStatus fromValue(String value) { + for (CheckDepositStatus b : CheckDepositStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CheckDepositStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CheckDepositStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CheckDepositStatus.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositTransaction.java b/src/main/java/org/openapitools/client/model/CheckDepositTransaction.java new file mode 100644 index 00000000..b6b510db --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public CheckDepositTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public CheckDepositTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CheckDepositTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositTransaction checkDepositTransaction = (CheckDepositTransaction) o; + return Objects.equals(this.attributes, checkDepositTransaction.attributes) && + Objects.equals(this.relationships, checkDepositTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositTransaction is not found in the empty JSON string", CheckDepositTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositTransaction + * @throws IOException if the JSON string is invalid with respect to CheckDepositTransaction + */ + public static CheckDepositTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositTransaction.class); + } + + /** + * Convert an instance of CheckDepositTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckDepositTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/CheckDepositTransactionAllOfAttributes.java new file mode 100644 index 00000000..d15b9b93 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckDepositTransactionAllOfAttributes.java @@ -0,0 +1,411 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckDepositTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckDepositTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CheckDepositTransactionAllOfAttributes() { + } + + public CheckDepositTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CheckDepositTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CheckDepositTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CheckDepositTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public CheckDepositTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public CheckDepositTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckDepositTransactionAllOfAttributes checkDepositTransactionAllOfAttributes = (CheckDepositTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, checkDepositTransactionAllOfAttributes.createdAt) && + Objects.equals(this.amount, checkDepositTransactionAllOfAttributes.amount) && + Objects.equals(this.direction, checkDepositTransactionAllOfAttributes.direction) && + Objects.equals(this.balance, checkDepositTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, checkDepositTransactionAllOfAttributes.summary) && + Objects.equals(this.tags, checkDepositTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, balance, summary, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckDepositTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckDepositTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckDepositTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckDepositTransactionAllOfAttributes is not found in the empty JSON string", CheckDepositTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckDepositTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckDepositTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckDepositTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckDepositTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckDepositTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckDepositTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckDepositTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckDepositTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckDepositTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckDepositTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to CheckDepositTransactionAllOfAttributes + */ + public static CheckDepositTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckDepositTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of CheckDepositTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckPayment.java b/src/main/java/org/openapitools/client/model/CheckPayment.java new file mode 100644 index 00000000..dab940f0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckPayment.java @@ -0,0 +1,312 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckPaymentAttributes; +import org.openapitools.client.model.CheckPaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "checkPayment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CheckPaymentRelationships relationships; + + public CheckPayment() { + } + + public CheckPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CheckPayment id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public CheckPayment attributes(CheckPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CheckPayment relationships(CheckPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CheckPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CheckPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckPayment checkPayment = (CheckPayment) o; + return Objects.equals(this.type, checkPayment.type) && + Objects.equals(this.id, checkPayment.id) && + Objects.equals(this.attributes, checkPayment.attributes) && + Objects.equals(this.relationships, checkPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckPayment is not found in the empty JSON string", CheckPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + CheckPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CheckPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckPayment + * @throws IOException if the JSON string is invalid with respect to CheckPayment + */ + public static CheckPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckPayment.class); + } + + /** + * Convert an instance of CheckPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckPaymentAttributes.java b/src/main/java/org/openapitools/client/model/CheckPaymentAttributes.java new file mode 100644 index 00000000..36f1628b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckPaymentAttributes.java @@ -0,0 +1,1117 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.CheckPaymentAttributesCounterparty; +import org.openapitools.client.model.ReturnReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckPaymentAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_RETURN_CUTOFF_TIME = "returnCutoffTime"; + @SerializedName(SERIALIZED_NAME_RETURN_CUTOFF_TIME) + private OffsetDateTime returnCutoffTime; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + MARKEDFORRETURN("MarkedForReturn"), + + RETURNED("Returned"), + + PROCESSED("Processed"), + + PENDINGREVIEW("PendingReview"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_MEMO = "memo"; + @SerializedName(SERIALIZED_NAME_MEMO) + private String memo; + + /** + * Gets or Sets deliveryStatus + */ + @JsonAdapter(DeliveryStatusEnum.Adapter.class) + public enum DeliveryStatusEnum { + MAILED("Mailed"), + + INLOCALAREA("InLocalArea"), + + DELIVERED("Delivered"), + + REROUTED("Rerouted"), + + RETURNEDTOSENDER("ReturnedToSender"); + + private String value; + + DeliveryStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DeliveryStatusEnum fromValue(String value) { + for (DeliveryStatusEnum b : DeliveryStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DeliveryStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DeliveryStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DeliveryStatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DELIVERY_STATUS = "deliveryStatus"; + @SerializedName(SERIALIZED_NAME_DELIVERY_STATUS) + private DeliveryStatusEnum deliveryStatus; + + public static final String SERIALIZED_NAME_SEND_AT = "sendAt"; + @SerializedName(SERIALIZED_NAME_SEND_AT) + private OffsetDateTime sendAt; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private CheckPaymentAttributesCounterparty counterparty; + + public static final String SERIALIZED_NAME_TRACKED_AT = "trackedAt"; + @SerializedName(SERIALIZED_NAME_TRACKED_AT) + private OffsetDateTime trackedAt; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + private String postalCode; + + public static final String SERIALIZED_NAME_EXPECTED_DELIVERY = "expectedDelivery"; + @SerializedName(SERIALIZED_NAME_EXPECTED_DELIVERY) + private LocalDate expectedDelivery; + + public static final String SERIALIZED_NAME_ORIGINATED = "originated"; + @SerializedName(SERIALIZED_NAME_ORIGINATED) + private Boolean originated; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expirationDate"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private LocalDate expirationDate; + + public static final String SERIALIZED_NAME_REJECT_REASON = "rejectReason"; + @SerializedName(SERIALIZED_NAME_REJECT_REASON) + private String rejectReason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_RETURN_REASON = "returnReason"; + @SerializedName(SERIALIZED_NAME_RETURN_REASON) + private ReturnReason returnReason; + + /** + * Gets or Sets pendingReviewReasons + */ + @JsonAdapter(PendingReviewReasonsEnum.Adapter.class) + public enum PendingReviewReasonsEnum { + NAMEMISSMATCH("NameMissMatch"), + + SOFTLIMIT("SoftLimit"); + + private String value; + + PendingReviewReasonsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PendingReviewReasonsEnum fromValue(String value) { + for (PendingReviewReasonsEnum b : PendingReviewReasonsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PendingReviewReasonsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PendingReviewReasonsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PendingReviewReasonsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PENDING_REVIEW_REASONS = "pendingReviewReasons"; + @SerializedName(SERIALIZED_NAME_PENDING_REVIEW_REASONS) + private List pendingReviewReasons; + + public static final String SERIALIZED_NAME_CHECK_NUMBER = "checkNumber"; + @SerializedName(SERIALIZED_NAME_CHECK_NUMBER) + private String checkNumber; + + public static final String SERIALIZED_NAME_ON_US_AUXILIARY = "onUsAuxiliary"; + @SerializedName(SERIALIZED_NAME_ON_US_AUXILIARY) + private String onUsAuxiliary; + + public static final String SERIALIZED_NAME_ON_US = "onUs"; + @SerializedName(SERIALIZED_NAME_ON_US) + private String onUs; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER = "counterpartyRoutingNumber"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER) + private String counterpartyRoutingNumber; + + /** + * Gets or Sets additionalVerificationStatus + */ + @JsonAdapter(AdditionalVerificationStatusEnum.Adapter.class) + public enum AdditionalVerificationStatusEnum { + REQUIRED("Required"), + + NOTREQUIRED("NotRequired"), + + APPROVED("Approved"); + + private String value; + + AdditionalVerificationStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdditionalVerificationStatusEnum fromValue(String value) { + for (AdditionalVerificationStatusEnum b : AdditionalVerificationStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdditionalVerificationStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdditionalVerificationStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdditionalVerificationStatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ADDITIONAL_VERIFICATION_STATUS = "additionalVerificationStatus"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_VERIFICATION_STATUS) + private AdditionalVerificationStatusEnum additionalVerificationStatus; + + public CheckPaymentAttributes() { + } + + public CheckPaymentAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CheckPaymentAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public CheckPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CheckPaymentAttributes returnCutoffTime(OffsetDateTime returnCutoffTime) { + + this.returnCutoffTime = returnCutoffTime; + return this; + } + + /** + * Get returnCutoffTime + * @return returnCutoffTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getReturnCutoffTime() { + return returnCutoffTime; + } + + + public void setReturnCutoffTime(OffsetDateTime returnCutoffTime) { + this.returnCutoffTime = returnCutoffTime; + } + + + public CheckPaymentAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public CheckPaymentAttributes memo(String memo) { + + this.memo = memo; + return this; + } + + /** + * Get memo + * @return memo + **/ + @javax.annotation.Nullable + public String getMemo() { + return memo; + } + + + public void setMemo(String memo) { + this.memo = memo; + } + + + public CheckPaymentAttributes deliveryStatus(DeliveryStatusEnum deliveryStatus) { + + this.deliveryStatus = deliveryStatus; + return this; + } + + /** + * Get deliveryStatus + * @return deliveryStatus + **/ + @javax.annotation.Nullable + public DeliveryStatusEnum getDeliveryStatus() { + return deliveryStatus; + } + + + public void setDeliveryStatus(DeliveryStatusEnum deliveryStatus) { + this.deliveryStatus = deliveryStatus; + } + + + public CheckPaymentAttributes sendAt(OffsetDateTime sendAt) { + + this.sendAt = sendAt; + return this; + } + + /** + * Get sendAt + * @return sendAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getSendAt() { + return sendAt; + } + + + public void setSendAt(OffsetDateTime sendAt) { + this.sendAt = sendAt; + } + + + public CheckPaymentAttributes counterparty(CheckPaymentAttributesCounterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public CheckPaymentAttributesCounterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(CheckPaymentAttributesCounterparty counterparty) { + this.counterparty = counterparty; + } + + + public CheckPaymentAttributes trackedAt(OffsetDateTime trackedAt) { + + this.trackedAt = trackedAt; + return this; + } + + /** + * Get trackedAt + * @return trackedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getTrackedAt() { + return trackedAt; + } + + + public void setTrackedAt(OffsetDateTime trackedAt) { + this.trackedAt = trackedAt; + } + + + public CheckPaymentAttributes postalCode(String postalCode) { + + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + **/ + @javax.annotation.Nullable + public String getPostalCode() { + return postalCode; + } + + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + + public CheckPaymentAttributes expectedDelivery(LocalDate expectedDelivery) { + + this.expectedDelivery = expectedDelivery; + return this; + } + + /** + * Get expectedDelivery + * @return expectedDelivery + **/ + @javax.annotation.Nullable + public LocalDate getExpectedDelivery() { + return expectedDelivery; + } + + + public void setExpectedDelivery(LocalDate expectedDelivery) { + this.expectedDelivery = expectedDelivery; + } + + + public CheckPaymentAttributes originated(Boolean originated) { + + this.originated = originated; + return this; + } + + /** + * Get originated + * @return originated + **/ + @javax.annotation.Nonnull + public Boolean getOriginated() { + return originated; + } + + + public void setOriginated(Boolean originated) { + this.originated = originated; + } + + + public CheckPaymentAttributes expirationDate(LocalDate expirationDate) { + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nullable + public LocalDate getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(LocalDate expirationDate) { + this.expirationDate = expirationDate; + } + + + public CheckPaymentAttributes rejectReason(String rejectReason) { + + this.rejectReason = rejectReason; + return this; + } + + /** + * Get rejectReason + * @return rejectReason + **/ + @javax.annotation.Nullable + public String getRejectReason() { + return rejectReason; + } + + + public void setRejectReason(String rejectReason) { + this.rejectReason = rejectReason; + } + + + public CheckPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CheckPaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CheckPaymentAttributes returnReason(ReturnReason returnReason) { + + this.returnReason = returnReason; + return this; + } + + /** + * Get returnReason + * @return returnReason + **/ + @javax.annotation.Nullable + public ReturnReason getReturnReason() { + return returnReason; + } + + + public void setReturnReason(ReturnReason returnReason) { + this.returnReason = returnReason; + } + + + public CheckPaymentAttributes pendingReviewReasons(List pendingReviewReasons) { + + this.pendingReviewReasons = pendingReviewReasons; + return this; + } + + public CheckPaymentAttributes addPendingReviewReasonsItem(PendingReviewReasonsEnum pendingReviewReasonsItem) { + if (this.pendingReviewReasons == null) { + this.pendingReviewReasons = new ArrayList<>(); + } + this.pendingReviewReasons.add(pendingReviewReasonsItem); + return this; + } + + /** + * Get pendingReviewReasons + * @return pendingReviewReasons + **/ + @javax.annotation.Nullable + public List getPendingReviewReasons() { + return pendingReviewReasons; + } + + + public void setPendingReviewReasons(List pendingReviewReasons) { + this.pendingReviewReasons = pendingReviewReasons; + } + + + public CheckPaymentAttributes checkNumber(String checkNumber) { + + this.checkNumber = checkNumber; + return this; + } + + /** + * Get checkNumber + * @return checkNumber + **/ + @javax.annotation.Nullable + public String getCheckNumber() { + return checkNumber; + } + + + public void setCheckNumber(String checkNumber) { + this.checkNumber = checkNumber; + } + + + public CheckPaymentAttributes onUsAuxiliary(String onUsAuxiliary) { + + this.onUsAuxiliary = onUsAuxiliary; + return this; + } + + /** + * Get onUsAuxiliary + * @return onUsAuxiliary + **/ + @javax.annotation.Nullable + public String getOnUsAuxiliary() { + return onUsAuxiliary; + } + + + public void setOnUsAuxiliary(String onUsAuxiliary) { + this.onUsAuxiliary = onUsAuxiliary; + } + + + public CheckPaymentAttributes onUs(String onUs) { + + this.onUs = onUs; + return this; + } + + /** + * Get onUs + * @return onUs + **/ + @javax.annotation.Nullable + public String getOnUs() { + return onUs; + } + + + public void setOnUs(String onUs) { + this.onUs = onUs; + } + + + public CheckPaymentAttributes counterpartyRoutingNumber(String counterpartyRoutingNumber) { + + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + return this; + } + + /** + * Get counterpartyRoutingNumber + * @return counterpartyRoutingNumber + **/ + @javax.annotation.Nullable + public String getCounterpartyRoutingNumber() { + return counterpartyRoutingNumber; + } + + + public void setCounterpartyRoutingNumber(String counterpartyRoutingNumber) { + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + } + + + public CheckPaymentAttributes additionalVerificationStatus(AdditionalVerificationStatusEnum additionalVerificationStatus) { + + this.additionalVerificationStatus = additionalVerificationStatus; + return this; + } + + /** + * Get additionalVerificationStatus + * @return additionalVerificationStatus + **/ + @javax.annotation.Nullable + public AdditionalVerificationStatusEnum getAdditionalVerificationStatus() { + return additionalVerificationStatus; + } + + + public void setAdditionalVerificationStatus(AdditionalVerificationStatusEnum additionalVerificationStatus) { + this.additionalVerificationStatus = additionalVerificationStatus; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckPaymentAttributes checkPaymentAttributes = (CheckPaymentAttributes) o; + return Objects.equals(this.createdAt, checkPaymentAttributes.createdAt) && + Objects.equals(this.updatedAt, checkPaymentAttributes.updatedAt) && + Objects.equals(this.amount, checkPaymentAttributes.amount) && + Objects.equals(this.returnCutoffTime, checkPaymentAttributes.returnCutoffTime) && + Objects.equals(this.status, checkPaymentAttributes.status) && + Objects.equals(this.memo, checkPaymentAttributes.memo) && + Objects.equals(this.deliveryStatus, checkPaymentAttributes.deliveryStatus) && + Objects.equals(this.sendAt, checkPaymentAttributes.sendAt) && + Objects.equals(this.counterparty, checkPaymentAttributes.counterparty) && + Objects.equals(this.trackedAt, checkPaymentAttributes.trackedAt) && + Objects.equals(this.postalCode, checkPaymentAttributes.postalCode) && + Objects.equals(this.expectedDelivery, checkPaymentAttributes.expectedDelivery) && + Objects.equals(this.originated, checkPaymentAttributes.originated) && + Objects.equals(this.expirationDate, checkPaymentAttributes.expirationDate) && + Objects.equals(this.rejectReason, checkPaymentAttributes.rejectReason) && + Objects.equals(this.tags, checkPaymentAttributes.tags) && + Objects.equals(this.description, checkPaymentAttributes.description) && + Objects.equals(this.returnReason, checkPaymentAttributes.returnReason) && + Objects.equals(this.pendingReviewReasons, checkPaymentAttributes.pendingReviewReasons) && + Objects.equals(this.checkNumber, checkPaymentAttributes.checkNumber) && + Objects.equals(this.onUsAuxiliary, checkPaymentAttributes.onUsAuxiliary) && + Objects.equals(this.onUs, checkPaymentAttributes.onUs) && + Objects.equals(this.counterpartyRoutingNumber, checkPaymentAttributes.counterpartyRoutingNumber) && + Objects.equals(this.additionalVerificationStatus, checkPaymentAttributes.additionalVerificationStatus); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, returnCutoffTime, status, memo, deliveryStatus, sendAt, counterparty, trackedAt, postalCode, expectedDelivery, originated, expirationDate, rejectReason, tags, description, returnReason, pendingReviewReasons, checkNumber, onUsAuxiliary, onUs, counterpartyRoutingNumber, additionalVerificationStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckPaymentAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" returnCutoffTime: ").append(toIndentedString(returnCutoffTime)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" memo: ").append(toIndentedString(memo)).append("\n"); + sb.append(" deliveryStatus: ").append(toIndentedString(deliveryStatus)).append("\n"); + sb.append(" sendAt: ").append(toIndentedString(sendAt)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" trackedAt: ").append(toIndentedString(trackedAt)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" expectedDelivery: ").append(toIndentedString(expectedDelivery)).append("\n"); + sb.append(" originated: ").append(toIndentedString(originated)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" rejectReason: ").append(toIndentedString(rejectReason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" returnReason: ").append(toIndentedString(returnReason)).append("\n"); + sb.append(" pendingReviewReasons: ").append(toIndentedString(pendingReviewReasons)).append("\n"); + sb.append(" checkNumber: ").append(toIndentedString(checkNumber)).append("\n"); + sb.append(" onUsAuxiliary: ").append(toIndentedString(onUsAuxiliary)).append("\n"); + sb.append(" onUs: ").append(toIndentedString(onUs)).append("\n"); + sb.append(" counterpartyRoutingNumber: ").append(toIndentedString(counterpartyRoutingNumber)).append("\n"); + sb.append(" additionalVerificationStatus: ").append(toIndentedString(additionalVerificationStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("returnCutoffTime"); + openapiFields.add("status"); + openapiFields.add("memo"); + openapiFields.add("deliveryStatus"); + openapiFields.add("sendAt"); + openapiFields.add("counterparty"); + openapiFields.add("trackedAt"); + openapiFields.add("postalCode"); + openapiFields.add("expectedDelivery"); + openapiFields.add("originated"); + openapiFields.add("expirationDate"); + openapiFields.add("rejectReason"); + openapiFields.add("tags"); + openapiFields.add("description"); + openapiFields.add("returnReason"); + openapiFields.add("pendingReviewReasons"); + openapiFields.add("checkNumber"); + openapiFields.add("onUsAuxiliary"); + openapiFields.add("onUs"); + openapiFields.add("counterpartyRoutingNumber"); + openapiFields.add("additionalVerificationStatus"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("originated"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckPaymentAttributes is not found in the empty JSON string", CheckPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("memo") != null && !jsonObj.get("memo").isJsonNull()) && !jsonObj.get("memo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `memo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("memo").toString())); + } + if ((jsonObj.get("deliveryStatus") != null && !jsonObj.get("deliveryStatus").isJsonNull()) && !jsonObj.get("deliveryStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deliveryStatus").toString())); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + CheckPaymentAttributesCounterparty.validateJsonElement(jsonObj.get("counterparty")); + } + if ((jsonObj.get("postalCode") != null && !jsonObj.get("postalCode").isJsonNull()) && !jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if ((jsonObj.get("rejectReason") != null && !jsonObj.get("rejectReason").isJsonNull()) && !jsonObj.get("rejectReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rejectReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rejectReason").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("pendingReviewReasons") != null && !jsonObj.get("pendingReviewReasons").isJsonNull() && !jsonObj.get("pendingReviewReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `pendingReviewReasons` to be an array in the JSON string but got `%s`", jsonObj.get("pendingReviewReasons").toString())); + } + if ((jsonObj.get("checkNumber") != null && !jsonObj.get("checkNumber").isJsonNull()) && !jsonObj.get("checkNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `checkNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("checkNumber").toString())); + } + if ((jsonObj.get("onUsAuxiliary") != null && !jsonObj.get("onUsAuxiliary").isJsonNull()) && !jsonObj.get("onUsAuxiliary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `onUsAuxiliary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("onUsAuxiliary").toString())); + } + if ((jsonObj.get("onUs") != null && !jsonObj.get("onUs").isJsonNull()) && !jsonObj.get("onUs").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `onUs` to be a primitive type in the JSON string but got `%s`", jsonObj.get("onUs").toString())); + } + if ((jsonObj.get("counterpartyRoutingNumber") != null && !jsonObj.get("counterpartyRoutingNumber").isJsonNull()) && !jsonObj.get("counterpartyRoutingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyRoutingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyRoutingNumber").toString())); + } + if ((jsonObj.get("additionalVerificationStatus") != null && !jsonObj.get("additionalVerificationStatus").isJsonNull()) && !jsonObj.get("additionalVerificationStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalVerificationStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalVerificationStatus").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CheckPaymentAttributes + */ + public static CheckPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckPaymentAttributes.class); + } + + /** + * Convert an instance of CheckPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckPaymentAttributesCounterparty.java b/src/main/java/org/openapitools/client/model/CheckPaymentAttributesCounterparty.java new file mode 100644 index 00000000..a7b07e23 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckPaymentAttributesCounterparty.java @@ -0,0 +1,269 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckPaymentAttributesCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckPaymentAttributesCounterparty { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_COUNTERPARTY_MOVED = "counterpartyMoved"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_MOVED) + private Boolean counterpartyMoved; + + public CheckPaymentAttributesCounterparty() { + } + + public CheckPaymentAttributesCounterparty name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CheckPaymentAttributesCounterparty address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CheckPaymentAttributesCounterparty counterpartyMoved(Boolean counterpartyMoved) { + + this.counterpartyMoved = counterpartyMoved; + return this; + } + + /** + * Get counterpartyMoved + * @return counterpartyMoved + **/ + @javax.annotation.Nullable + public Boolean getCounterpartyMoved() { + return counterpartyMoved; + } + + + public void setCounterpartyMoved(Boolean counterpartyMoved) { + this.counterpartyMoved = counterpartyMoved; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckPaymentAttributesCounterparty checkPaymentAttributesCounterparty = (CheckPaymentAttributesCounterparty) o; + return Objects.equals(this.name, checkPaymentAttributesCounterparty.name) && + Objects.equals(this.address, checkPaymentAttributesCounterparty.address) && + Objects.equals(this.counterpartyMoved, checkPaymentAttributesCounterparty.counterpartyMoved); + } + + @Override + public int hashCode() { + return Objects.hash(name, address, counterpartyMoved); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckPaymentAttributesCounterparty {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" counterpartyMoved: ").append(toIndentedString(counterpartyMoved)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("address"); + openapiFields.add("counterpartyMoved"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckPaymentAttributesCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckPaymentAttributesCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckPaymentAttributesCounterparty is not found in the empty JSON string", CheckPaymentAttributesCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckPaymentAttributesCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckPaymentAttributesCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckPaymentAttributesCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckPaymentAttributesCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckPaymentAttributesCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckPaymentAttributesCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckPaymentAttributesCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckPaymentAttributesCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckPaymentAttributesCounterparty + * @throws IOException if the JSON string is invalid with respect to CheckPaymentAttributesCounterparty + */ + public static CheckPaymentAttributesCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckPaymentAttributesCounterparty.class); + } + + /** + * Convert an instance of CheckPaymentAttributesCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckPaymentRelationship.java b/src/main/java/org/openapitools/client/model/CheckPaymentRelationship.java new file mode 100644 index 00000000..b152f2f2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckPaymentRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PaymentRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckPaymentRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckPaymentRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private PaymentRelationshipData data; + + public CheckPaymentRelationship() { + } + + public CheckPaymentRelationship data(PaymentRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public PaymentRelationshipData getData() { + return data; + } + + + public void setData(PaymentRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckPaymentRelationship checkPaymentRelationship = (CheckPaymentRelationship) o; + return Objects.equals(this.data, checkPaymentRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckPaymentRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckPaymentRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckPaymentRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckPaymentRelationship is not found in the empty JSON string", CheckPaymentRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckPaymentRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckPaymentRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckPaymentRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PaymentRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckPaymentRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckPaymentRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckPaymentRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckPaymentRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckPaymentRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckPaymentRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckPaymentRelationship + * @throws IOException if the JSON string is invalid with respect to CheckPaymentRelationship + */ + public static CheckPaymentRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckPaymentRelationship.class); + } + + /** + * Convert an instance of CheckPaymentRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckPaymentRelationships.java b/src/main/java/org/openapitools/client/model/CheckPaymentRelationships.java new file mode 100644 index 00000000..d0e33bd9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckPaymentRelationships.java @@ -0,0 +1,315 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomersRelationship; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransaction; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsAccount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RecurringAchPaymentRelationshipsAccount account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; + @SerializedName(SERIALIZED_NAME_CUSTOMERS) + private CustomersRelationship customers; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + @SerializedName(SERIALIZED_NAME_TRANSACTION) + private ReceivedPaymentRelationshipsReceivePaymentTransaction transaction; + + public CheckPaymentRelationships() { + } + + public CheckPaymentRelationships account(RecurringAchPaymentRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RecurringAchPaymentRelationshipsAccount account) { + this.account = account; + } + + + public CheckPaymentRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + public CheckPaymentRelationships customers(CustomersRelationship customers) { + + this.customers = customers; + return this; + } + + /** + * Get customers + * @return customers + **/ + @javax.annotation.Nullable + public CustomersRelationship getCustomers() { + return customers; + } + + + public void setCustomers(CustomersRelationship customers) { + this.customers = customers; + } + + + public CheckPaymentRelationships transaction(ReceivedPaymentRelationshipsReceivePaymentTransaction transaction) { + + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * @return transaction + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsReceivePaymentTransaction getTransaction() { + return transaction; + } + + + public void setTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction transaction) { + this.transaction = transaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckPaymentRelationships checkPaymentRelationships = (CheckPaymentRelationships) o; + return Objects.equals(this.account, checkPaymentRelationships.account) && + Objects.equals(this.customer, checkPaymentRelationships.customer) && + Objects.equals(this.customers, checkPaymentRelationships.customers) && + Objects.equals(this.transaction, checkPaymentRelationships.transaction); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer, customers, transaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("customers"); + openapiFields.add("transaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckPaymentRelationships is not found in the empty JSON string", CheckPaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckPaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckPaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckPaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + RecurringAchPaymentRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `customers` + if (jsonObj.get("customers") != null && !jsonObj.get("customers").isJsonNull()) { + CustomersRelationship.validateJsonElement(jsonObj.get("customers")); + } + // validate the optional field `transaction` + if (jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) { + ReceivedPaymentRelationshipsReceivePaymentTransaction.validateJsonElement(jsonObj.get("transaction")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to CheckPaymentRelationships + */ + public static CheckPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckPaymentRelationships.class); + } + + /** + * Convert an instance of CheckPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CheckPaymentTransaction.java b/src/main/java/org/openapitools/client/model/CheckPaymentTransaction.java new file mode 100644 index 00000000..9db113e4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CheckPaymentTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CheckPaymentTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CheckPaymentTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public CheckPaymentTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public CheckPaymentTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CheckPaymentTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckPaymentTransaction checkPaymentTransaction = (CheckPaymentTransaction) o; + return Objects.equals(this.attributes, checkPaymentTransaction.attributes) && + Objects.equals(this.relationships, checkPaymentTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckPaymentTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckPaymentTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckPaymentTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckPaymentTransaction is not found in the empty JSON string", CheckPaymentTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckPaymentTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckPaymentTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckPaymentTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckPaymentTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckPaymentTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckPaymentTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckPaymentTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckPaymentTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckPaymentTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckPaymentTransaction + * @throws IOException if the JSON string is invalid with respect to CheckPaymentTransaction + */ + public static CheckPaymentTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckPaymentTransaction.class); + } + + /** + * Convert an instance of CheckPaymentTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CloseAccountRequest.java b/src/main/java/org/openapitools/client/model/CloseAccountRequest.java new file mode 100644 index 00000000..0d7136b2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CloseAccountRequest.java @@ -0,0 +1,288 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CloseAccountRequestAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CloseAccountRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CloseAccountRequest { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CREDITACCOUNTCLOSE("creditAccountClose"), + + DEPOSITACCOUNTCLOSE("depositAccountClose"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CloseAccountRequestAttributes attributes; + + public CloseAccountRequest() { + } + + public CloseAccountRequest type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CloseAccountRequest attributes(CloseAccountRequestAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CloseAccountRequestAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CloseAccountRequestAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloseAccountRequest closeAccountRequest = (CloseAccountRequest) o; + return Objects.equals(this.type, closeAccountRequest.type) && + Objects.equals(this.attributes, closeAccountRequest.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloseAccountRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CloseAccountRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CloseAccountRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CloseAccountRequest is not found in the empty JSON string", CloseAccountRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CloseAccountRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CloseAccountRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CloseAccountRequestAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CloseAccountRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CloseAccountRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CloseAccountRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CloseAccountRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CloseAccountRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CloseAccountRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CloseAccountRequest + * @throws IOException if the JSON string is invalid with respect to CloseAccountRequest + */ + public static CloseAccountRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CloseAccountRequest.class); + } + + /** + * Convert an instance of CloseAccountRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CloseAccountRequestAttributes.java b/src/main/java/org/openapitools/client/model/CloseAccountRequestAttributes.java new file mode 100644 index 00000000..c237cf1c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CloseAccountRequestAttributes.java @@ -0,0 +1,357 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CloseAccountRequestAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CloseAccountRequestAttributes { + /** + * Gets or Sets reason + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + BYCUSTOMER("ByCustomer"), + + FRAUD("Fraud"); + + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReasonEnum reason = ReasonEnum.BYCUSTOMER; + + /** + * Gets or Sets fraudReason + */ + @JsonAdapter(FraudReasonEnum.Adapter.class) + public enum FraudReasonEnum { + ACHACTIVITY("ACHActivity"), + + CARDACTIVITY("CardActivity"), + + CHECKACTIVITY("CheckActivity"), + + APPLICATIONHISTORY("ApplicationHistory"), + + ACCOUNTACTIVITY("AccountActivity"), + + CLIENTIDENTIFIED("ClientIdentified"), + + IDENTITYTHEFT("IdentityTheft"), + + LINKEDTOFRAUDULENTCUSTOMER("LinkedToFraudulentCustomer"); + + private String value; + + FraudReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FraudReasonEnum fromValue(String value) { + for (FraudReasonEnum b : FraudReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final FraudReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FraudReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FraudReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_FRAUD_REASON = "fraudReason"; + @SerializedName(SERIALIZED_NAME_FRAUD_REASON) + private FraudReasonEnum fraudReason; + + public CloseAccountRequestAttributes() { + } + + public CloseAccountRequestAttributes reason(ReasonEnum reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public ReasonEnum getReason() { + return reason; + } + + + public void setReason(ReasonEnum reason) { + this.reason = reason; + } + + + public CloseAccountRequestAttributes fraudReason(FraudReasonEnum fraudReason) { + + this.fraudReason = fraudReason; + return this; + } + + /** + * Get fraudReason + * @return fraudReason + **/ + @javax.annotation.Nullable + public FraudReasonEnum getFraudReason() { + return fraudReason; + } + + + public void setFraudReason(FraudReasonEnum fraudReason) { + this.fraudReason = fraudReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CloseAccountRequestAttributes closeAccountRequestAttributes = (CloseAccountRequestAttributes) o; + return Objects.equals(this.reason, closeAccountRequestAttributes.reason) && + Objects.equals(this.fraudReason, closeAccountRequestAttributes.fraudReason); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(reason, fraudReason); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CloseAccountRequestAttributes {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" fraudReason: ").append(toIndentedString(fraudReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + openapiFields.add("fraudReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CloseAccountRequestAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CloseAccountRequestAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CloseAccountRequestAttributes is not found in the empty JSON string", CloseAccountRequestAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CloseAccountRequestAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CloseAccountRequestAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("fraudReason") != null && !jsonObj.get("fraudReason").isJsonNull()) && !jsonObj.get("fraudReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fraudReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fraudReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CloseAccountRequestAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CloseAccountRequestAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CloseAccountRequestAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CloseAccountRequestAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CloseAccountRequestAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CloseAccountRequestAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CloseAccountRequestAttributes + * @throws IOException if the JSON string is invalid with respect to CloseAccountRequestAttributes + */ + public static CloseAccountRequestAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CloseAccountRequestAttributes.class); + } + + /** + * Convert an instance of CloseAccountRequestAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Contact.java b/src/main/java/org/openapitools/client/model/Contact.java new file mode 100644 index 00000000..cef3fc5e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Contact.java @@ -0,0 +1,317 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Contact + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Contact { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public Contact() { + } + + public Contact fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Contact email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Contact phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public Contact jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Contact contact = (Contact) o; + return Objects.equals(this.fullName, contact.fullName) && + Objects.equals(this.email, contact.email) && + Objects.equals(this.phone, contact.phone) && + Objects.equals(this.jwtSubject, contact.jwtSubject); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, jwtSubject); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Contact {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("jwtSubject"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Contact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Contact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Contact is not found in the empty JSON string", Contact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Contact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Contact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Contact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Contact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Contact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Contact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Contact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Contact given an JSON string + * + * @param jsonString JSON string + * @return An instance of Contact + * @throws IOException if the JSON string is invalid with respect to Contact + */ + public static Contact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Contact.class); + } + + /** + * Convert an instance of Contact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Coordinates.java b/src/main/java/org/openapitools/client/model/Coordinates.java new file mode 100644 index 00000000..e86667ae --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Coordinates.java @@ -0,0 +1,243 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Coordinates + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Coordinates { + public static final String SERIALIZED_NAME_LONGITUDE = "longitude"; + @SerializedName(SERIALIZED_NAME_LONGITUDE) + private BigDecimal longitude; + + public static final String SERIALIZED_NAME_LATITUDE = "latitude"; + @SerializedName(SERIALIZED_NAME_LATITUDE) + private BigDecimal latitude; + + public Coordinates() { + } + + public Coordinates longitude(BigDecimal longitude) { + + this.longitude = longitude; + return this; + } + + /** + * Get longitude + * @return longitude + **/ + @javax.annotation.Nonnull + public BigDecimal getLongitude() { + return longitude; + } + + + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + + + public Coordinates latitude(BigDecimal latitude) { + + this.latitude = latitude; + return this; + } + + /** + * Get latitude + * @return latitude + **/ + @javax.annotation.Nonnull + public BigDecimal getLatitude() { + return latitude; + } + + + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Coordinates coordinates = (Coordinates) o; + return Objects.equals(this.longitude, coordinates.longitude) && + Objects.equals(this.latitude, coordinates.latitude); + } + + @Override + public int hashCode() { + return Objects.hash(longitude, latitude); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Coordinates {\n"); + sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n"); + sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("longitude"); + openapiFields.add("latitude"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("longitude"); + openapiRequiredFields.add("latitude"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Coordinates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Coordinates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Coordinates is not found in the empty JSON string", Coordinates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Coordinates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Coordinates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Coordinates.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Coordinates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Coordinates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Coordinates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Coordinates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Coordinates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Coordinates given an JSON string + * + * @param jsonString JSON string + * @return An instance of Coordinates + * @throws IOException if the JSON string is invalid with respect to Coordinates + */ + public static Coordinates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Coordinates.class); + } + + /** + * Convert an instance of Coordinates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Counterparty.java b/src/main/java/org/openapitools/client/model/Counterparty.java new file mode 100644 index 00000000..e6bded7f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Counterparty.java @@ -0,0 +1,361 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Counterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Counterparty { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + /** + * Gets or Sets accountType + */ + @JsonAdapter(AccountTypeEnum.Adapter.class) + public enum AccountTypeEnum { + CHECKING("Checking"), + + SAVINGS("Savings"), + + LOAN("Loan"); + + private String value; + + AccountTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AccountTypeEnum fromValue(String value) { + for (AccountTypeEnum b : AccountTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AccountTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AccountTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AccountTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + private AccountTypeEnum accountType; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public Counterparty() { + } + + public Counterparty routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public Counterparty accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public Counterparty accountType(AccountTypeEnum accountType) { + + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * @return accountType + **/ + @javax.annotation.Nonnull + public AccountTypeEnum getAccountType() { + return accountType; + } + + + public void setAccountType(AccountTypeEnum accountType) { + this.accountType = accountType; + } + + + public Counterparty name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Counterparty counterparty = (Counterparty) o; + return Objects.equals(this.routingNumber, counterparty.routingNumber) && + Objects.equals(this.accountNumber, counterparty.accountNumber) && + Objects.equals(this.accountType, counterparty.accountType) && + Objects.equals(this.name, counterparty.name); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, accountNumber, accountType, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Counterparty {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("accountType"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("accountType"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Counterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Counterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Counterparty is not found in the empty JSON string", Counterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Counterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Counterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Counterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if (!jsonObj.get("accountType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountType").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Counterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Counterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Counterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Counterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Counterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Counterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of Counterparty + * @throws IOException if the JSON string is invalid with respect to Counterparty + */ + public static Counterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Counterparty.class); + } + + /** + * Convert an instance of Counterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Counterparty1.java b/src/main/java/org/openapitools/client/model/Counterparty1.java new file mode 100644 index 00000000..f01f5de2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Counterparty1.java @@ -0,0 +1,305 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty1Attributes; +import org.openapitools.client.model.CounterpartyRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Counterparty1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Counterparty1 { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private Counterparty1Attributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CounterpartyRelationships relationships; + + public Counterparty1() { + } + + public Counterparty1 type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Counterparty1 id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Counterparty1 attributes(Counterparty1Attributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public Counterparty1Attributes getAttributes() { + return attributes; + } + + + public void setAttributes(Counterparty1Attributes attributes) { + this.attributes = attributes; + } + + + public Counterparty1 relationships(CounterpartyRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CounterpartyRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CounterpartyRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Counterparty1 counterparty1 = (Counterparty1) o; + return Objects.equals(this.type, counterparty1.type) && + Objects.equals(this.id, counterparty1.id) && + Objects.equals(this.attributes, counterparty1.attributes) && + Objects.equals(this.relationships, counterparty1.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Counterparty1 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Counterparty1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Counterparty1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Counterparty1 is not found in the empty JSON string", Counterparty1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Counterparty1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Counterparty1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + Counterparty1Attributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CounterpartyRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Counterparty1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Counterparty1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Counterparty1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Counterparty1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Counterparty1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Counterparty1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Counterparty1 + * @throws IOException if the JSON string is invalid with respect to Counterparty1 + */ + public static Counterparty1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Counterparty1.class); + } + + /** + * Convert an instance of Counterparty1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Counterparty1Attributes.java b/src/main/java/org/openapitools/client/model/Counterparty1Attributes.java new file mode 100644 index 00000000..5642acaf --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Counterparty1Attributes.java @@ -0,0 +1,612 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Counterparty1Attributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Counterparty1Attributes { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + /** + * Gets or Sets accountType + */ + @JsonAdapter(AccountTypeEnum.Adapter.class) + public enum AccountTypeEnum { + CHECKING("Checking"), + + SAVINGS("Savings"), + + LOAN("Loan"); + + private String value; + + AccountTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AccountTypeEnum fromValue(String value) { + for (AccountTypeEnum b : AccountTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AccountTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AccountTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AccountTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + private AccountTypeEnum accountType; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESS("Business"), + + PERSON("Person"), + + UNKNOWN("Unknown"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_BANK = "bank"; + @SerializedName(SERIALIZED_NAME_BANK) + private String bank; + + /** + * Gets or Sets permissions + */ + @JsonAdapter(PermissionsEnum.Adapter.class) + public enum PermissionsEnum { + CREDITONLY("CreditOnly"), + + DEBITONLY("DebitOnly"), + + CREDITANDDEBIT("CreditAndDebit"); + + private String value; + + PermissionsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PermissionsEnum fromValue(String value) { + for (PermissionsEnum b : PermissionsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PermissionsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PermissionsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PermissionsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private PermissionsEnum permissions; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public Counterparty1Attributes() { + } + + public Counterparty1Attributes routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public Counterparty1Attributes accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public Counterparty1Attributes accountType(AccountTypeEnum accountType) { + + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * @return accountType + **/ + @javax.annotation.Nonnull + public AccountTypeEnum getAccountType() { + return accountType; + } + + + public void setAccountType(AccountTypeEnum accountType) { + this.accountType = accountType; + } + + + public Counterparty1Attributes type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Counterparty1Attributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Counterparty1Attributes bank(String bank) { + + this.bank = bank; + return this; + } + + /** + * Get bank + * @return bank + **/ + @javax.annotation.Nullable + public String getBank() { + return bank; + } + + + public void setBank(String bank) { + this.bank = bank; + } + + + public Counterparty1Attributes permissions(PermissionsEnum permissions) { + + this.permissions = permissions; + return this; + } + + /** + * Get permissions + * @return permissions + **/ + @javax.annotation.Nonnull + public PermissionsEnum getPermissions() { + return permissions; + } + + + public void setPermissions(PermissionsEnum permissions) { + this.permissions = permissions; + } + + + public Counterparty1Attributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public Counterparty1Attributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Counterparty1Attributes counterparty1Attributes = (Counterparty1Attributes) o; + return Objects.equals(this.routingNumber, counterparty1Attributes.routingNumber) && + Objects.equals(this.accountNumber, counterparty1Attributes.accountNumber) && + Objects.equals(this.accountType, counterparty1Attributes.accountType) && + Objects.equals(this.type, counterparty1Attributes.type) && + Objects.equals(this.name, counterparty1Attributes.name) && + Objects.equals(this.bank, counterparty1Attributes.bank) && + Objects.equals(this.permissions, counterparty1Attributes.permissions) && + Objects.equals(this.tags, counterparty1Attributes.tags) && + Objects.equals(this.createdAt, counterparty1Attributes.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, accountNumber, accountType, type, name, bank, permissions, tags, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Counterparty1Attributes {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" bank: ").append(toIndentedString(bank)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("accountType"); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("bank"); + openapiFields.add("permissions"); + openapiFields.add("tags"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("accountType"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("permissions"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Counterparty1Attributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Counterparty1Attributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Counterparty1Attributes is not found in the empty JSON string", Counterparty1Attributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Counterparty1Attributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Counterparty1Attributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Counterparty1Attributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if (!jsonObj.get("accountType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountType").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("bank") != null && !jsonObj.get("bank").isJsonNull()) && !jsonObj.get("bank").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bank` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bank").toString())); + } + if (!jsonObj.get("permissions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Counterparty1Attributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Counterparty1Attributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Counterparty1Attributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Counterparty1Attributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Counterparty1Attributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Counterparty1Attributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of Counterparty1Attributes + * @throws IOException if the JSON string is invalid with respect to Counterparty1Attributes + */ + public static Counterparty1Attributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Counterparty1Attributes.class); + } + + /** + * Convert an instance of Counterparty1Attributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Counterparty2.java b/src/main/java/org/openapitools/client/model/Counterparty2.java new file mode 100644 index 00000000..6bda26dd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Counterparty2.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Counterparty2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Counterparty2 { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public Counterparty2() { + } + + public Counterparty2 routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public Counterparty2 accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public Counterparty2 name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Counterparty2 counterparty2 = (Counterparty2) o; + return Objects.equals(this.routingNumber, counterparty2.routingNumber) && + Objects.equals(this.accountNumber, counterparty2.accountNumber) && + Objects.equals(this.name, counterparty2.name); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, accountNumber, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Counterparty2 {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Counterparty2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Counterparty2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Counterparty2 is not found in the empty JSON string", Counterparty2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Counterparty2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Counterparty2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Counterparty2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Counterparty2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Counterparty2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Counterparty2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Counterparty2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Counterparty2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Counterparty2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Counterparty2 + * @throws IOException if the JSON string is invalid with respect to Counterparty2 + */ + public static Counterparty2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Counterparty2.class); + } + + /** + * Convert an instance of Counterparty2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationship.java b/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationship.java new file mode 100644 index 00000000..e9238b37 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyAccountRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyAccountRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyAccountRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CounterpartyAccountRelationshipData data; + + public CounterpartyAccountRelationship() { + } + + public CounterpartyAccountRelationship data(CounterpartyAccountRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CounterpartyAccountRelationshipData getData() { + return data; + } + + + public void setData(CounterpartyAccountRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyAccountRelationship counterpartyAccountRelationship = (CounterpartyAccountRelationship) o; + return Objects.equals(this.data, counterpartyAccountRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyAccountRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyAccountRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyAccountRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyAccountRelationship is not found in the empty JSON string", CounterpartyAccountRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyAccountRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyAccountRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyAccountRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CounterpartyAccountRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyAccountRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyAccountRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyAccountRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyAccountRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyAccountRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyAccountRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyAccountRelationship + * @throws IOException if the JSON string is invalid with respect to CounterpartyAccountRelationship + */ + public static CounterpartyAccountRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyAccountRelationship.class); + } + + /** + * Convert an instance of CounterpartyAccountRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationship1.java b/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationship1.java new file mode 100644 index 00000000..d2ff0d10 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationship1.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipsAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyAccountRelationship1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyAccountRelationship1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RelationshipsAccountData data; + + public CounterpartyAccountRelationship1() { + } + + public CounterpartyAccountRelationship1 data(RelationshipsAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RelationshipsAccountData getData() { + return data; + } + + + public void setData(RelationshipsAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyAccountRelationship1 counterpartyAccountRelationship1 = (CounterpartyAccountRelationship1) o; + return Objects.equals(this.data, counterpartyAccountRelationship1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyAccountRelationship1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyAccountRelationship1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyAccountRelationship1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyAccountRelationship1 is not found in the empty JSON string", CounterpartyAccountRelationship1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyAccountRelationship1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyAccountRelationship1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyAccountRelationship1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RelationshipsAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyAccountRelationship1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyAccountRelationship1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyAccountRelationship1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyAccountRelationship1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyAccountRelationship1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyAccountRelationship1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyAccountRelationship1 + * @throws IOException if the JSON string is invalid with respect to CounterpartyAccountRelationship1 + */ + public static CounterpartyAccountRelationship1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyAccountRelationship1.class); + } + + /** + * Convert an instance of CounterpartyAccountRelationship1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationshipData.java b/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationshipData.java new file mode 100644 index 00000000..324094af --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyAccountRelationshipData.java @@ -0,0 +1,295 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyAccountRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyAccountRelationshipData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"), + + DEPOSITACCOUNT("depositAccount"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public CounterpartyAccountRelationshipData() { + } + + public CounterpartyAccountRelationshipData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CounterpartyAccountRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyAccountRelationshipData counterpartyAccountRelationshipData = (CounterpartyAccountRelationshipData) o; + return Objects.equals(this.type, counterpartyAccountRelationshipData.type) && + Objects.equals(this.id, counterpartyAccountRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyAccountRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyAccountRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyAccountRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyAccountRelationshipData is not found in the empty JSON string", CounterpartyAccountRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyAccountRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyAccountRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyAccountRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyAccountRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyAccountRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyAccountRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyAccountRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyAccountRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyAccountRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyAccountRelationshipData + * @throws IOException if the JSON string is invalid with respect to CounterpartyAccountRelationshipData + */ + public static CounterpartyAccountRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyAccountRelationshipData.class); + } + + /** + * Convert an instance of CounterpartyAccountRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyBalance.java b/src/main/java/org/openapitools/client/model/CounterpartyBalance.java new file mode 100644 index 00000000..9c25da7a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyBalance.java @@ -0,0 +1,313 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyBalanceAttributes; +import org.openapitools.client.model.CounterpartyBalanceRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyBalance + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyBalance { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "counterpartyBalance"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CounterpartyBalanceAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CounterpartyBalanceRelationships relationships; + + public CounterpartyBalance() { + } + + public CounterpartyBalance type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CounterpartyBalance id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public CounterpartyBalance attributes(CounterpartyBalanceAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CounterpartyBalanceAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CounterpartyBalanceAttributes attributes) { + this.attributes = attributes; + } + + + public CounterpartyBalance relationships(CounterpartyBalanceRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CounterpartyBalanceRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CounterpartyBalanceRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyBalance counterpartyBalance = (CounterpartyBalance) o; + return Objects.equals(this.type, counterpartyBalance.type) && + Objects.equals(this.id, counterpartyBalance.id) && + Objects.equals(this.attributes, counterpartyBalance.attributes) && + Objects.equals(this.relationships, counterpartyBalance.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyBalance {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyBalance + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyBalance.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyBalance is not found in the empty JSON string", CounterpartyBalance.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyBalance.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyBalance` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyBalance.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CounterpartyBalanceAttributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the required field `relationships` + CounterpartyBalanceRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyBalance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyBalance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyBalance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyBalance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyBalance read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyBalance given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyBalance + * @throws IOException if the JSON string is invalid with respect to CounterpartyBalance + */ + public static CounterpartyBalance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyBalance.class); + } + + /** + * Convert an instance of CounterpartyBalance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyBalanceAttributes.java b/src/main/java/org/openapitools/client/model/CounterpartyBalanceAttributes.java new file mode 100644 index 00000000..a5b15f29 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyBalanceAttributes.java @@ -0,0 +1,242 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyBalanceAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyBalanceAttributes { + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private BigDecimal balance; + + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + private BigDecimal available; + + public CounterpartyBalanceAttributes() { + } + + public CounterpartyBalanceAttributes balance(BigDecimal balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public BigDecimal getBalance() { + return balance; + } + + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } + + + public CounterpartyBalanceAttributes available(BigDecimal available) { + + this.available = available; + return this; + } + + /** + * Get available + * @return available + **/ + @javax.annotation.Nullable + public BigDecimal getAvailable() { + return available; + } + + + public void setAvailable(BigDecimal available) { + this.available = available; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyBalanceAttributes counterpartyBalanceAttributes = (CounterpartyBalanceAttributes) o; + return Objects.equals(this.balance, counterpartyBalanceAttributes.balance) && + Objects.equals(this.available, counterpartyBalanceAttributes.available); + } + + @Override + public int hashCode() { + return Objects.hash(balance, available); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyBalanceAttributes {\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("balance"); + openapiFields.add("available"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("balance"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyBalanceAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyBalanceAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyBalanceAttributes is not found in the empty JSON string", CounterpartyBalanceAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyBalanceAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyBalanceAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyBalanceAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyBalanceAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyBalanceAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyBalanceAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyBalanceAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyBalanceAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyBalanceAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyBalanceAttributes + * @throws IOException if the JSON string is invalid with respect to CounterpartyBalanceAttributes + */ + public static CounterpartyBalanceAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyBalanceAttributes.class); + } + + /** + * Convert an instance of CounterpartyBalanceAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationships.java b/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationships.java new file mode 100644 index 00000000..56c5b080 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationships.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyBalanceRelationshipsCounterparty; +import org.openapitools.client.model.RelationshipsCustomer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyBalanceRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyBalanceRelationships { + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private CounterpartyBalanceRelationshipsCounterparty counterparty; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private RelationshipsCustomer customer; + + public CounterpartyBalanceRelationships() { + } + + public CounterpartyBalanceRelationships counterparty(CounterpartyBalanceRelationshipsCounterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public CounterpartyBalanceRelationshipsCounterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(CounterpartyBalanceRelationshipsCounterparty counterparty) { + this.counterparty = counterparty; + } + + + public CounterpartyBalanceRelationships customer(RelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public RelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(RelationshipsCustomer customer) { + this.customer = customer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyBalanceRelationships counterpartyBalanceRelationships = (CounterpartyBalanceRelationships) o; + return Objects.equals(this.counterparty, counterpartyBalanceRelationships.counterparty) && + Objects.equals(this.customer, counterpartyBalanceRelationships.customer); + } + + @Override + public int hashCode() { + return Objects.hash(counterparty, customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyBalanceRelationships {\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("counterparty"); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("counterparty"); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyBalanceRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyBalanceRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyBalanceRelationships is not found in the empty JSON string", CounterpartyBalanceRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyBalanceRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyBalanceRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyBalanceRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `counterparty` + CounterpartyBalanceRelationshipsCounterparty.validateJsonElement(jsonObj.get("counterparty")); + // validate the required field `customer` + RelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyBalanceRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyBalanceRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyBalanceRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyBalanceRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyBalanceRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyBalanceRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyBalanceRelationships + * @throws IOException if the JSON string is invalid with respect to CounterpartyBalanceRelationships + */ + public static CounterpartyBalanceRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyBalanceRelationships.class); + } + + /** + * Convert an instance of CounterpartyBalanceRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationshipsCounterparty.java b/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationshipsCounterparty.java new file mode 100644 index 00000000..3dcd1b68 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationshipsCounterparty.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyBalanceRelationshipsCounterpartyData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyBalanceRelationshipsCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyBalanceRelationshipsCounterparty { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CounterpartyBalanceRelationshipsCounterpartyData data; + + public CounterpartyBalanceRelationshipsCounterparty() { + } + + public CounterpartyBalanceRelationshipsCounterparty data(CounterpartyBalanceRelationshipsCounterpartyData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CounterpartyBalanceRelationshipsCounterpartyData getData() { + return data; + } + + + public void setData(CounterpartyBalanceRelationshipsCounterpartyData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyBalanceRelationshipsCounterparty counterpartyBalanceRelationshipsCounterparty = (CounterpartyBalanceRelationshipsCounterparty) o; + return Objects.equals(this.data, counterpartyBalanceRelationshipsCounterparty.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyBalanceRelationshipsCounterparty {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyBalanceRelationshipsCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyBalanceRelationshipsCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyBalanceRelationshipsCounterparty is not found in the empty JSON string", CounterpartyBalanceRelationshipsCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyBalanceRelationshipsCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyBalanceRelationshipsCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyBalanceRelationshipsCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CounterpartyBalanceRelationshipsCounterpartyData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyBalanceRelationshipsCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyBalanceRelationshipsCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyBalanceRelationshipsCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyBalanceRelationshipsCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyBalanceRelationshipsCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyBalanceRelationshipsCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyBalanceRelationshipsCounterparty + * @throws IOException if the JSON string is invalid with respect to CounterpartyBalanceRelationshipsCounterparty + */ + public static CounterpartyBalanceRelationshipsCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyBalanceRelationshipsCounterparty.class); + } + + /** + * Convert an instance of CounterpartyBalanceRelationshipsCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationshipsCounterpartyData.java b/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationshipsCounterpartyData.java new file mode 100644 index 00000000..7a4db3e8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyBalanceRelationshipsCounterpartyData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyBalanceRelationshipsCounterpartyData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyBalanceRelationshipsCounterpartyData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "counterparty"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public CounterpartyBalanceRelationshipsCounterpartyData() { + } + + public CounterpartyBalanceRelationshipsCounterpartyData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CounterpartyBalanceRelationshipsCounterpartyData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyBalanceRelationshipsCounterpartyData counterpartyBalanceRelationshipsCounterpartyData = (CounterpartyBalanceRelationshipsCounterpartyData) o; + return Objects.equals(this.type, counterpartyBalanceRelationshipsCounterpartyData.type) && + Objects.equals(this.id, counterpartyBalanceRelationshipsCounterpartyData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyBalanceRelationshipsCounterpartyData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyBalanceRelationshipsCounterpartyData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyBalanceRelationshipsCounterpartyData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyBalanceRelationshipsCounterpartyData is not found in the empty JSON string", CounterpartyBalanceRelationshipsCounterpartyData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyBalanceRelationshipsCounterpartyData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyBalanceRelationshipsCounterpartyData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyBalanceRelationshipsCounterpartyData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyBalanceRelationshipsCounterpartyData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyBalanceRelationshipsCounterpartyData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyBalanceRelationshipsCounterpartyData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyBalanceRelationshipsCounterpartyData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyBalanceRelationshipsCounterpartyData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyBalanceRelationshipsCounterpartyData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyBalanceRelationshipsCounterpartyData + * @throws IOException if the JSON string is invalid with respect to CounterpartyBalanceRelationshipsCounterpartyData + */ + public static CounterpartyBalanceRelationshipsCounterpartyData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyBalanceRelationshipsCounterpartyData.class); + } + + /** + * Convert an instance of CounterpartyBalanceRelationshipsCounterpartyData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyCustomerRelationship.java b/src/main/java/org/openapitools/client/model/CounterpartyCustomerRelationship.java new file mode 100644 index 00000000..5038df82 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyCustomerRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipsCustomerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyCustomerRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyCustomerRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RelationshipsCustomerData data; + + public CounterpartyCustomerRelationship() { + } + + public CounterpartyCustomerRelationship data(RelationshipsCustomerData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RelationshipsCustomerData getData() { + return data; + } + + + public void setData(RelationshipsCustomerData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyCustomerRelationship counterpartyCustomerRelationship = (CounterpartyCustomerRelationship) o; + return Objects.equals(this.data, counterpartyCustomerRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyCustomerRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyCustomerRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyCustomerRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyCustomerRelationship is not found in the empty JSON string", CounterpartyCustomerRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyCustomerRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyCustomerRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyCustomerRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RelationshipsCustomerData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyCustomerRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyCustomerRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyCustomerRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyCustomerRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyCustomerRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyCustomerRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyCustomerRelationship + * @throws IOException if the JSON string is invalid with respect to CounterpartyCustomerRelationship + */ + public static CounterpartyCustomerRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyCustomerRelationship.class); + } + + /** + * Convert an instance of CounterpartyCustomerRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyRelationship.java b/src/main/java/org/openapitools/client/model/CounterpartyRelationship.java new file mode 100644 index 00000000..d3e07742 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CounterpartyRelationshipData data; + + public CounterpartyRelationship() { + } + + public CounterpartyRelationship data(CounterpartyRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CounterpartyRelationshipData getData() { + return data; + } + + + public void setData(CounterpartyRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyRelationship counterpartyRelationship = (CounterpartyRelationship) o; + return Objects.equals(this.data, counterpartyRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyRelationship is not found in the empty JSON string", CounterpartyRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CounterpartyRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyRelationship + * @throws IOException if the JSON string is invalid with respect to CounterpartyRelationship + */ + public static CounterpartyRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyRelationship.class); + } + + /** + * Convert an instance of CounterpartyRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyRelationshipData.java b/src/main/java/org/openapitools/client/model/CounterpartyRelationshipData.java new file mode 100644 index 00000000..def1a579 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyRelationshipData.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyRelationshipData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"), + + DEPOSITACCOUNT("depositAccount"), + + COUNTERPARTY("counterparty"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public CounterpartyRelationshipData() { + } + + public CounterpartyRelationshipData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CounterpartyRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyRelationshipData counterpartyRelationshipData = (CounterpartyRelationshipData) o; + return Objects.equals(this.type, counterpartyRelationshipData.type) && + Objects.equals(this.id, counterpartyRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyRelationshipData is not found in the empty JSON string", CounterpartyRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyRelationshipData + * @throws IOException if the JSON string is invalid with respect to CounterpartyRelationshipData + */ + public static CounterpartyRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyRelationshipData.class); + } + + /** + * Convert an instance of CounterpartyRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CounterpartyRelationships.java b/src/main/java/org/openapitools/client/model/CounterpartyRelationships.java new file mode 100644 index 00000000..02d15592 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CounterpartyRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipsCustomer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CounterpartyRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CounterpartyRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private RelationshipsCustomer customer; + + public CounterpartyRelationships() { + } + + public CounterpartyRelationships customer(RelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public RelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(RelationshipsCustomer customer) { + this.customer = customer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CounterpartyRelationships counterpartyRelationships = (CounterpartyRelationships) o; + return Objects.equals(this.customer, counterpartyRelationships.customer); + } + + @Override + public int hashCode() { + return Objects.hash(customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CounterpartyRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CounterpartyRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CounterpartyRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CounterpartyRelationships is not found in the empty JSON string", CounterpartyRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CounterpartyRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CounterpartyRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CounterpartyRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `customer` + RelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CounterpartyRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CounterpartyRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CounterpartyRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CounterpartyRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CounterpartyRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CounterpartyRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CounterpartyRelationships + * @throws IOException if the JSON string is invalid with respect to CounterpartyRelationships + */ + public static CounterpartyRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CounterpartyRelationships.class); + } + + /** + * Convert an instance of CounterpartyRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAccount.java b/src/main/java/org/openapitools/client/model/CreateAccount.java new file mode 100644 index 00000000..97687a44 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateAccountData data; + + public CreateAccount() { + } + + public CreateAccount data(CreateAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CreateAccountData getData() { + return data; + } + + + public void setData(CreateAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAccount createAccount = (CreateAccount) o; + return Objects.equals(this.data, createAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAccount is not found in the empty JSON string", CreateAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccount + * @throws IOException if the JSON string is invalid with respect to CreateAccount + */ + public static CreateAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccount.class); + } + + /** + * Convert an instance of CreateAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAccountData.java b/src/main/java/org/openapitools/client/model/CreateAccountData.java new file mode 100644 index 00000000..98ed331f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAccountData.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCreditAccount; +import org.openapitools.client.model.CreateDepositAccount; +import org.openapitools.client.model.CreateDepositAccountAttributes; +import org.openapitools.client.model.CreateDepositAccountRelationships; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAccountData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateAccountData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateCreditAccount = gson.getDelegateAdapter(this, TypeToken.get(CreateCreditAccount.class)); + final TypeAdapter adapterCreateDepositAccount = gson.getDelegateAdapter(this, TypeToken.get(CreateDepositAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccountData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateCreditAccount` + if (value.getActualInstance() instanceof CreateCreditAccount) { + JsonElement element = adapterCreateCreditAccount.toJsonTree((CreateCreditAccount)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateDepositAccount` + if (value.getActualInstance() instanceof CreateDepositAccount) { + JsonElement element = adapterCreateDepositAccount.toJsonTree((CreateDepositAccount)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateCreditAccount, CreateDepositAccount"); + } + + @Override + public CreateAccountData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateCreditAccount + try { + // validate the JSON object to see if any exception is thrown + CreateCreditAccount.validateJsonElement(jsonElement); + actualAdapter = adapterCreateCreditAccount; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateCreditAccount'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateCreditAccount failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateCreditAccount'", e); + } + // deserialize CreateDepositAccount + try { + // validate the JSON object to see if any exception is thrown + CreateDepositAccount.validateJsonElement(jsonElement); + actualAdapter = adapterCreateDepositAccount; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateDepositAccount'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateDepositAccount failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateDepositAccount'", e); + } + + if (match == 1) { + CreateAccountData ret = new CreateAccountData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateAccountData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateAccountData() { + super("oneOf", Boolean.FALSE); + } + + public CreateAccountData(CreateCreditAccount o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateAccountData(CreateDepositAccount o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateCreditAccount", CreateCreditAccount.class); + schemas.put("CreateDepositAccount", CreateDepositAccount.class); + } + + @Override + public Map> getSchemas() { + return CreateAccountData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateCreditAccount, CreateDepositAccount + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateCreditAccount) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateDepositAccount) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateCreditAccount, CreateDepositAccount"); + } + + /** + * Get the actual instance, which can be the following: + * CreateCreditAccount, CreateDepositAccount + * + * @return The actual instance (CreateCreditAccount, CreateDepositAccount) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateCreditAccount`. If the actual instance is not `CreateCreditAccount`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateCreditAccount` + * @throws ClassCastException if the instance is not `CreateCreditAccount` + */ + public CreateCreditAccount getCreateCreditAccount() throws ClassCastException { + return (CreateCreditAccount)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateDepositAccount`. If the actual instance is not `CreateDepositAccount`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateDepositAccount` + * @throws ClassCastException if the instance is not `CreateDepositAccount` + */ + public CreateDepositAccount getCreateDepositAccount() throws ClassCastException { + return (CreateDepositAccount)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateCreditAccount + try { + CreateCreditAccount.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateCreditAccount failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateDepositAccount + try { + CreateDepositAccount.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateDepositAccount failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateAccountData with oneOf schemas: CreateCreditAccount, CreateDepositAccount. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccountData + * @throws IOException if the JSON string is invalid with respect to CreateAccountData + */ + public static CreateAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccountData.class); + } + + /** + * Convert an instance of CreateAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchCounterparty.java b/src/main/java/org/openapitools/client/model/CreateAchCounterparty.java new file mode 100644 index 00000000..a18ee49c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchCounterparty.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchCounterpartyAttributes; +import org.openapitools.client.model.CreateCounterpartyRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchCounterparty { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateAchCounterpartyAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCounterpartyRelationships relationships; + + public CreateAchCounterparty() { + } + + public CreateAchCounterparty type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateAchCounterparty attributes(CreateAchCounterpartyAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateAchCounterpartyAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateAchCounterpartyAttributes attributes) { + this.attributes = attributes; + } + + + public CreateAchCounterparty relationships(CreateCounterpartyRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCounterpartyRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCounterpartyRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchCounterparty createAchCounterparty = (CreateAchCounterparty) o; + return Objects.equals(this.type, createAchCounterparty.type) && + Objects.equals(this.attributes, createAchCounterparty.attributes) && + Objects.equals(this.relationships, createAchCounterparty.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchCounterparty {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchCounterparty is not found in the empty JSON string", CreateAchCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateAchCounterpartyAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCounterpartyRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchCounterparty + * @throws IOException if the JSON string is invalid with respect to CreateAchCounterparty + */ + public static CreateAchCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchCounterparty.class); + } + + /** + * Convert an instance of CreateAchCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchCounterpartyAttributes.java b/src/main/java/org/openapitools/client/model/CreateAchCounterpartyAttributes.java new file mode 100644 index 00000000..c4ec7e58 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchCounterpartyAttributes.java @@ -0,0 +1,581 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchCounterpartyAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchCounterpartyAttributes { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + /** + * Gets or Sets accountType + */ + @JsonAdapter(AccountTypeEnum.Adapter.class) + public enum AccountTypeEnum { + CHECKING("Checking"), + + SAVINGS("Savings"), + + LOAN("Loan"); + + private String value; + + AccountTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AccountTypeEnum fromValue(String value) { + for (AccountTypeEnum b : AccountTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AccountTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AccountTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AccountTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + private AccountTypeEnum accountType; + + /** + * Gets or Sets permissions + */ + @JsonAdapter(PermissionsEnum.Adapter.class) + public enum PermissionsEnum { + CREDITONLY("CreditOnly"), + + DEBITONLY("DebitOnly"), + + CREDITANDDEBIT("CreditAndDebit"); + + private String value; + + PermissionsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PermissionsEnum fromValue(String value) { + for (PermissionsEnum b : PermissionsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PermissionsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PermissionsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PermissionsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private PermissionsEnum permissions; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESS("Business"), + + PERSON("Person"), + + UNKNOWN("Unknown"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public CreateAchCounterpartyAttributes() { + } + + public CreateAchCounterpartyAttributes routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public CreateAchCounterpartyAttributes accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public CreateAchCounterpartyAttributes accountType(AccountTypeEnum accountType) { + + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * @return accountType + **/ + @javax.annotation.Nonnull + public AccountTypeEnum getAccountType() { + return accountType; + } + + + public void setAccountType(AccountTypeEnum accountType) { + this.accountType = accountType; + } + + + public CreateAchCounterpartyAttributes permissions(PermissionsEnum permissions) { + + this.permissions = permissions; + return this; + } + + /** + * Get permissions + * @return permissions + **/ + @javax.annotation.Nullable + public PermissionsEnum getPermissions() { + return permissions; + } + + + public void setPermissions(PermissionsEnum permissions) { + this.permissions = permissions; + } + + + public CreateAchCounterpartyAttributes type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateAchCounterpartyAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CreateAchCounterpartyAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateAchCounterpartyAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchCounterpartyAttributes createAchCounterpartyAttributes = (CreateAchCounterpartyAttributes) o; + return Objects.equals(this.routingNumber, createAchCounterpartyAttributes.routingNumber) && + Objects.equals(this.accountNumber, createAchCounterpartyAttributes.accountNumber) && + Objects.equals(this.accountType, createAchCounterpartyAttributes.accountType) && + Objects.equals(this.permissions, createAchCounterpartyAttributes.permissions) && + Objects.equals(this.type, createAchCounterpartyAttributes.type) && + Objects.equals(this.name, createAchCounterpartyAttributes.name) && + Objects.equals(this.tags, createAchCounterpartyAttributes.tags) && + Objects.equals(this.idempotencyKey, createAchCounterpartyAttributes.idempotencyKey); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, accountNumber, accountType, permissions, type, name, tags, idempotencyKey); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchCounterpartyAttributes {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("accountType"); + openapiFields.add("permissions"); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("accountType"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchCounterpartyAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchCounterpartyAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchCounterpartyAttributes is not found in the empty JSON string", CreateAchCounterpartyAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchCounterpartyAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchCounterpartyAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchCounterpartyAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if (!jsonObj.get("accountType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountType").toString())); + } + if ((jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) && !jsonObj.get("permissions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchCounterpartyAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchCounterpartyAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchCounterpartyAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchCounterpartyAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchCounterpartyAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchCounterpartyAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchCounterpartyAttributes + * @throws IOException if the JSON string is invalid with respect to CreateAchCounterpartyAttributes + */ + public static CreateAchCounterpartyAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchCounterpartyAttributes.class); + } + + /** + * Convert an instance of CreateAchCounterpartyAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPayment.java b/src/main/java/org/openapitools/client/model/CreateAchPayment.java new file mode 100644 index 00000000..facba57f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPayment.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPaymentAttributes; +import org.openapitools.client.model.CreateAchPaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "achPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateAchPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchPaymentRelationships relationships; + + public CreateAchPayment() { + } + + public CreateAchPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateAchPayment attributes(CreateAchPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateAchPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateAchPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreateAchPayment relationships(CreateAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPayment createAchPayment = (CreateAchPayment) o; + return Objects.equals(this.type, createAchPayment.type) && + Objects.equals(this.attributes, createAchPayment.attributes) && + Objects.equals(this.relationships, createAchPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPayment is not found in the empty JSON string", CreateAchPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateAchPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPayment + * @throws IOException if the JSON string is invalid with respect to CreateAchPayment + */ + public static CreateAchPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPayment.class); + } + + /** + * Convert an instance of CreateAchPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentAttributes.java new file mode 100644 index 00000000..46a303ba --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentAttributes.java @@ -0,0 +1,554 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + DEBIT("Debit"), + + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets secCode + */ + @JsonAdapter(SecCodeEnum.Adapter.class) + public enum SecCodeEnum { + WEB("WEB"), + + CCD("CCD"), + + PPD("PPD"); + + private String value; + + SecCodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SecCodeEnum fromValue(String value) { + for (SecCodeEnum b : SecCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SecCodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SecCodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SecCodeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private SecCodeEnum secCode; + + public CreateAchPaymentAttributes() { + } + + public CreateAchPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateAchPaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateAchPaymentAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public CreateAchPaymentAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CreateAchPaymentAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public CreateAchPaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateAchPaymentAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + public CreateAchPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateAchPaymentAttributes secCode(SecCodeEnum secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public SecCodeEnum getSecCode() { + return secCode; + } + + + public void setSecCode(SecCodeEnum secCode) { + this.secCode = secCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentAttributes createAchPaymentAttributes = (CreateAchPaymentAttributes) o; + return Objects.equals(this.amount, createAchPaymentAttributes.amount) && + Objects.equals(this.description, createAchPaymentAttributes.description) && + Objects.equals(this.addenda, createAchPaymentAttributes.addenda) && + Objects.equals(this.direction, createAchPaymentAttributes.direction) && + Objects.equals(this.counterparty, createAchPaymentAttributes.counterparty) && + Objects.equals(this.idempotencyKey, createAchPaymentAttributes.idempotencyKey) && + Objects.equals(this.sameDay, createAchPaymentAttributes.sameDay) && + Objects.equals(this.tags, createAchPaymentAttributes.tags) && + Objects.equals(this.secCode, createAchPaymentAttributes.secCode); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, addenda, direction, counterparty, idempotencyKey, sameDay, tags, secCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("direction"); + openapiFields.add("counterparty"); + openapiFields.add("idempotencyKey"); + openapiFields.add("sameDay"); + openapiFields.add("tags"); + openapiFields.add("secCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentAttributes is not found in the empty JSON string", CreateAchPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + // validate the required field `counterparty` + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentAttributes + */ + public static CreateAchPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentAttributes.class); + } + + /** + * Convert an instance of CreateAchPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterparty.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterparty.java new file mode 100644 index 00000000..dde9d088 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterparty.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPaymentCounterpartyAttributes; +import org.openapitools.client.model.CreateAchPaymentCounterpartyRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentCounterparty { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "achPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateAchPaymentCounterpartyAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchPaymentCounterpartyRelationships relationships; + + public CreateAchPaymentCounterparty() { + } + + public CreateAchPaymentCounterparty type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateAchPaymentCounterparty attributes(CreateAchPaymentCounterpartyAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateAchPaymentCounterpartyAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateAchPaymentCounterpartyAttributes attributes) { + this.attributes = attributes; + } + + + public CreateAchPaymentCounterparty relationships(CreateAchPaymentCounterpartyRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchPaymentCounterpartyRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchPaymentCounterpartyRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentCounterparty createAchPaymentCounterparty = (CreateAchPaymentCounterparty) o; + return Objects.equals(this.type, createAchPaymentCounterparty.type) && + Objects.equals(this.attributes, createAchPaymentCounterparty.attributes) && + Objects.equals(this.relationships, createAchPaymentCounterparty.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentCounterparty {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentCounterparty is not found in the empty JSON string", CreateAchPaymentCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateAchPaymentCounterpartyAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchPaymentCounterpartyRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentCounterparty + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentCounterparty + */ + public static CreateAchPaymentCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentCounterparty.class); + } + + /** + * Convert an instance of CreateAchPaymentCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterpartyAttributes.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterpartyAttributes.java new file mode 100644 index 00000000..2fef820e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterpartyAttributes.java @@ -0,0 +1,550 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentCounterpartyAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentCounterpartyAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + DEBIT("Debit"), + + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_VERIFY_COUNTERPARTY_BALANCE = "verifyCounterpartyBalance"; + @SerializedName(SERIALIZED_NAME_VERIFY_COUNTERPARTY_BALANCE) + private Boolean verifyCounterpartyBalance = false; + + /** + * Gets or Sets secCode + */ + @JsonAdapter(SecCodeEnum.Adapter.class) + public enum SecCodeEnum { + WEB("WEB"), + + CCD("CCD"), + + PPD("PPD"); + + private String value; + + SecCodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SecCodeEnum fromValue(String value) { + for (SecCodeEnum b : SecCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SecCodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SecCodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SecCodeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private SecCodeEnum secCode; + + public CreateAchPaymentCounterpartyAttributes() { + } + + public CreateAchPaymentCounterpartyAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateAchPaymentCounterpartyAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateAchPaymentCounterpartyAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public CreateAchPaymentCounterpartyAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CreateAchPaymentCounterpartyAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + public CreateAchPaymentCounterpartyAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateAchPaymentCounterpartyAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateAchPaymentCounterpartyAttributes verifyCounterpartyBalance(Boolean verifyCounterpartyBalance) { + + this.verifyCounterpartyBalance = verifyCounterpartyBalance; + return this; + } + + /** + * Get verifyCounterpartyBalance + * @return verifyCounterpartyBalance + **/ + @javax.annotation.Nullable + public Boolean getVerifyCounterpartyBalance() { + return verifyCounterpartyBalance; + } + + + public void setVerifyCounterpartyBalance(Boolean verifyCounterpartyBalance) { + this.verifyCounterpartyBalance = verifyCounterpartyBalance; + } + + + public CreateAchPaymentCounterpartyAttributes secCode(SecCodeEnum secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public SecCodeEnum getSecCode() { + return secCode; + } + + + public void setSecCode(SecCodeEnum secCode) { + this.secCode = secCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentCounterpartyAttributes createAchPaymentCounterpartyAttributes = (CreateAchPaymentCounterpartyAttributes) o; + return Objects.equals(this.amount, createAchPaymentCounterpartyAttributes.amount) && + Objects.equals(this.description, createAchPaymentCounterpartyAttributes.description) && + Objects.equals(this.addenda, createAchPaymentCounterpartyAttributes.addenda) && + Objects.equals(this.direction, createAchPaymentCounterpartyAttributes.direction) && + Objects.equals(this.sameDay, createAchPaymentCounterpartyAttributes.sameDay) && + Objects.equals(this.idempotencyKey, createAchPaymentCounterpartyAttributes.idempotencyKey) && + Objects.equals(this.tags, createAchPaymentCounterpartyAttributes.tags) && + Objects.equals(this.verifyCounterpartyBalance, createAchPaymentCounterpartyAttributes.verifyCounterpartyBalance) && + Objects.equals(this.secCode, createAchPaymentCounterpartyAttributes.secCode); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, addenda, direction, sameDay, idempotencyKey, tags, verifyCounterpartyBalance, secCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentCounterpartyAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" verifyCounterpartyBalance: ").append(toIndentedString(verifyCounterpartyBalance)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("direction"); + openapiFields.add("sameDay"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + openapiFields.add("verifyCounterpartyBalance"); + openapiFields.add("secCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("direction"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentCounterpartyAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentCounterpartyAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentCounterpartyAttributes is not found in the empty JSON string", CreateAchPaymentCounterpartyAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentCounterpartyAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentCounterpartyAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentCounterpartyAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentCounterpartyAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentCounterpartyAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentCounterpartyAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentCounterpartyAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentCounterpartyAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentCounterpartyAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentCounterpartyAttributes + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentCounterpartyAttributes + */ + public static CreateAchPaymentCounterpartyAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentCounterpartyAttributes.class); + } + + /** + * Convert an instance of CreateAchPaymentCounterpartyAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterpartyRelationships.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterpartyRelationships.java new file mode 100644 index 00000000..d2174190 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentCounterpartyRelationships.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationship; +import org.openapitools.client.model.CounterpartyRelationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentCounterpartyRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentCounterpartyRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AccountRelationship account; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private CounterpartyRelationship counterparty; + + public CreateAchPaymentCounterpartyRelationships() { + } + + public CreateAchPaymentCounterpartyRelationships account(AccountRelationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public AccountRelationship getAccount() { + return account; + } + + + public void setAccount(AccountRelationship account) { + this.account = account; + } + + + public CreateAchPaymentCounterpartyRelationships counterparty(CounterpartyRelationship counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public CounterpartyRelationship getCounterparty() { + return counterparty; + } + + + public void setCounterparty(CounterpartyRelationship counterparty) { + this.counterparty = counterparty; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentCounterpartyRelationships createAchPaymentCounterpartyRelationships = (CreateAchPaymentCounterpartyRelationships) o; + return Objects.equals(this.account, createAchPaymentCounterpartyRelationships.account) && + Objects.equals(this.counterparty, createAchPaymentCounterpartyRelationships.counterparty); + } + + @Override + public int hashCode() { + return Objects.hash(account, counterparty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentCounterpartyRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("counterparty"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentCounterpartyRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentCounterpartyRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentCounterpartyRelationships is not found in the empty JSON string", CreateAchPaymentCounterpartyRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentCounterpartyRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentCounterpartyRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentCounterpartyRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + AccountRelationship.validateJsonElement(jsonObj.get("account")); + // validate the required field `counterparty` + CounterpartyRelationship.validateJsonElement(jsonObj.get("counterparty")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentCounterpartyRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentCounterpartyRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentCounterpartyRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentCounterpartyRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentCounterpartyRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentCounterpartyRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentCounterpartyRelationships + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentCounterpartyRelationships + */ + public static CreateAchPaymentCounterpartyRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentCounterpartyRelationships.class); + } + + /** + * Convert an instance of CreateAchPaymentCounterpartyRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentPlaid.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentPlaid.java new file mode 100644 index 00000000..fcf107ea --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentPlaid.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPaymentPlaidAttributes; +import org.openapitools.client.model.CreateAchPaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentPlaid + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentPlaid { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "achPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateAchPaymentPlaidAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchPaymentRelationships relationships; + + public CreateAchPaymentPlaid() { + } + + public CreateAchPaymentPlaid type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateAchPaymentPlaid attributes(CreateAchPaymentPlaidAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateAchPaymentPlaidAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateAchPaymentPlaidAttributes attributes) { + this.attributes = attributes; + } + + + public CreateAchPaymentPlaid relationships(CreateAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentPlaid createAchPaymentPlaid = (CreateAchPaymentPlaid) o; + return Objects.equals(this.type, createAchPaymentPlaid.type) && + Objects.equals(this.attributes, createAchPaymentPlaid.attributes) && + Objects.equals(this.relationships, createAchPaymentPlaid.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentPlaid {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentPlaid + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentPlaid.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentPlaid is not found in the empty JSON string", CreateAchPaymentPlaid.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentPlaid.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentPlaid` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentPlaid.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateAchPaymentPlaidAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentPlaid.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentPlaid' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentPlaid.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentPlaid value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentPlaid read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentPlaid given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentPlaid + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentPlaid + */ + public static CreateAchPaymentPlaid fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentPlaid.class); + } + + /** + * Convert an instance of CreateAchPaymentPlaid to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentPlaidAttributes.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentPlaidAttributes.java new file mode 100644 index 00000000..19154f81 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentPlaidAttributes.java @@ -0,0 +1,613 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentPlaidAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentPlaidAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + DEBIT("Debit"), + + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_PLAID_PROCESSOR_TOKEN = "plaidProcessorToken"; + @SerializedName(SERIALIZED_NAME_PLAID_PROCESSOR_TOKEN) + private String plaidProcessorToken; + + public static final String SERIALIZED_NAME_COUNTERPARTY_NAME = "counterpartyName"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_NAME) + private String counterpartyName; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay; + + public static final String SERIALIZED_NAME_VERIFY_COUNTERPARTY_BALANCE = "verifyCounterpartyBalance"; + @SerializedName(SERIALIZED_NAME_VERIFY_COUNTERPARTY_BALANCE) + private Boolean verifyCounterpartyBalance = false; + + /** + * Gets or Sets secCode + */ + @JsonAdapter(SecCodeEnum.Adapter.class) + public enum SecCodeEnum { + WEB("WEB"), + + CCD("CCD"), + + PPD("PPD"); + + private String value; + + SecCodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SecCodeEnum fromValue(String value) { + for (SecCodeEnum b : SecCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SecCodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SecCodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SecCodeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private SecCodeEnum secCode; + + public CreateAchPaymentPlaidAttributes() { + } + + public CreateAchPaymentPlaidAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateAchPaymentPlaidAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateAchPaymentPlaidAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public CreateAchPaymentPlaidAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CreateAchPaymentPlaidAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateAchPaymentPlaidAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateAchPaymentPlaidAttributes plaidProcessorToken(String plaidProcessorToken) { + + this.plaidProcessorToken = plaidProcessorToken; + return this; + } + + /** + * Get plaidProcessorToken + * @return plaidProcessorToken + **/ + @javax.annotation.Nonnull + public String getPlaidProcessorToken() { + return plaidProcessorToken; + } + + + public void setPlaidProcessorToken(String plaidProcessorToken) { + this.plaidProcessorToken = plaidProcessorToken; + } + + + public CreateAchPaymentPlaidAttributes counterpartyName(String counterpartyName) { + + this.counterpartyName = counterpartyName; + return this; + } + + /** + * Get counterpartyName + * @return counterpartyName + **/ + @javax.annotation.Nullable + public String getCounterpartyName() { + return counterpartyName; + } + + + public void setCounterpartyName(String counterpartyName) { + this.counterpartyName = counterpartyName; + } + + + public CreateAchPaymentPlaidAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + public CreateAchPaymentPlaidAttributes verifyCounterpartyBalance(Boolean verifyCounterpartyBalance) { + + this.verifyCounterpartyBalance = verifyCounterpartyBalance; + return this; + } + + /** + * Get verifyCounterpartyBalance + * @return verifyCounterpartyBalance + **/ + @javax.annotation.Nullable + public Boolean getVerifyCounterpartyBalance() { + return verifyCounterpartyBalance; + } + + + public void setVerifyCounterpartyBalance(Boolean verifyCounterpartyBalance) { + this.verifyCounterpartyBalance = verifyCounterpartyBalance; + } + + + public CreateAchPaymentPlaidAttributes secCode(SecCodeEnum secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public SecCodeEnum getSecCode() { + return secCode; + } + + + public void setSecCode(SecCodeEnum secCode) { + this.secCode = secCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentPlaidAttributes createAchPaymentPlaidAttributes = (CreateAchPaymentPlaidAttributes) o; + return Objects.equals(this.amount, createAchPaymentPlaidAttributes.amount) && + Objects.equals(this.description, createAchPaymentPlaidAttributes.description) && + Objects.equals(this.addenda, createAchPaymentPlaidAttributes.addenda) && + Objects.equals(this.direction, createAchPaymentPlaidAttributes.direction) && + Objects.equals(this.idempotencyKey, createAchPaymentPlaidAttributes.idempotencyKey) && + Objects.equals(this.tags, createAchPaymentPlaidAttributes.tags) && + Objects.equals(this.plaidProcessorToken, createAchPaymentPlaidAttributes.plaidProcessorToken) && + Objects.equals(this.counterpartyName, createAchPaymentPlaidAttributes.counterpartyName) && + Objects.equals(this.sameDay, createAchPaymentPlaidAttributes.sameDay) && + Objects.equals(this.verifyCounterpartyBalance, createAchPaymentPlaidAttributes.verifyCounterpartyBalance) && + Objects.equals(this.secCode, createAchPaymentPlaidAttributes.secCode); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, addenda, direction, idempotencyKey, tags, plaidProcessorToken, counterpartyName, sameDay, verifyCounterpartyBalance, secCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentPlaidAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" plaidProcessorToken: ").append(toIndentedString(plaidProcessorToken)).append("\n"); + sb.append(" counterpartyName: ").append(toIndentedString(counterpartyName)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append(" verifyCounterpartyBalance: ").append(toIndentedString(verifyCounterpartyBalance)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("direction"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + openapiFields.add("plaidProcessorToken"); + openapiFields.add("counterpartyName"); + openapiFields.add("sameDay"); + openapiFields.add("verifyCounterpartyBalance"); + openapiFields.add("secCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("plaidProcessorToken"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentPlaidAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentPlaidAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentPlaidAttributes is not found in the empty JSON string", CreateAchPaymentPlaidAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentPlaidAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentPlaidAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentPlaidAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if (!jsonObj.get("plaidProcessorToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `plaidProcessorToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("plaidProcessorToken").toString())); + } + if ((jsonObj.get("counterpartyName") != null && !jsonObj.get("counterpartyName").isJsonNull()) && !jsonObj.get("counterpartyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyName").toString())); + } + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentPlaidAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentPlaidAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentPlaidAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentPlaidAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentPlaidAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentPlaidAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentPlaidAttributes + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentPlaidAttributes + */ + public static CreateAchPaymentPlaidAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentPlaidAttributes.class); + } + + /** + * Convert an instance of CreateAchPaymentPlaidAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchPaymentRelationships.java b/src/main/java/org/openapitools/client/model/CreateAchPaymentRelationships.java new file mode 100644 index 00000000..c271d441 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchPaymentRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AccountRelationship account; + + public CreateAchPaymentRelationships() { + } + + public CreateAchPaymentRelationships account(AccountRelationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public AccountRelationship getAccount() { + return account; + } + + + public void setAccount(AccountRelationship account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchPaymentRelationships createAchPaymentRelationships = (CreateAchPaymentRelationships) o; + return Objects.equals(this.account, createAchPaymentRelationships.account); + } + + @Override + public int hashCode() { + return Objects.hash(account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchPaymentRelationships is not found in the empty JSON string", CreateAchPaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchPaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchPaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchPaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + AccountRelationship.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to CreateAchPaymentRelationships + */ + public static CreateAchPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchPaymentRelationships.class); + } + + /** + * Convert an instance of CreateAchPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchRepayment.java b/src/main/java/org/openapitools/client/model/CreateAchRepayment.java new file mode 100644 index 00000000..8a2a808b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchRepayment.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchRepaymentAttributes; +import org.openapitools.client.model.CreateAchRepaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchRepayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchRepayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "achRepayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateAchRepaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchRepaymentRelationships relationships; + + public CreateAchRepayment() { + } + + public CreateAchRepayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateAchRepayment attributes(CreateAchRepaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateAchRepaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateAchRepaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreateAchRepayment relationships(CreateAchRepaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchRepaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchRepaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchRepayment createAchRepayment = (CreateAchRepayment) o; + return Objects.equals(this.type, createAchRepayment.type) && + Objects.equals(this.attributes, createAchRepayment.attributes) && + Objects.equals(this.relationships, createAchRepayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchRepayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchRepayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchRepayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchRepayment is not found in the empty JSON string", CreateAchRepayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchRepayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchRepayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchRepayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateAchRepaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchRepaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchRepayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchRepayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchRepayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchRepayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchRepayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchRepayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchRepayment + * @throws IOException if the JSON string is invalid with respect to CreateAchRepayment + */ + public static CreateAchRepayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchRepayment.class); + } + + /** + * Convert an instance of CreateAchRepayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchRepaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreateAchRepaymentAttributes.java new file mode 100644 index 00000000..4fa6ecfb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchRepaymentAttributes.java @@ -0,0 +1,364 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchRepaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchRepaymentAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CreateAchRepaymentAttributes() { + } + + public CreateAchRepaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateAchRepaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateAchRepaymentAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public CreateAchRepaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateAchRepaymentAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + public CreateAchRepaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchRepaymentAttributes createAchRepaymentAttributes = (CreateAchRepaymentAttributes) o; + return Objects.equals(this.amount, createAchRepaymentAttributes.amount) && + Objects.equals(this.description, createAchRepaymentAttributes.description) && + Objects.equals(this.addenda, createAchRepaymentAttributes.addenda) && + Objects.equals(this.idempotencyKey, createAchRepaymentAttributes.idempotencyKey) && + Objects.equals(this.sameDay, createAchRepaymentAttributes.sameDay) && + Objects.equals(this.tags, createAchRepaymentAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, addenda, idempotencyKey, sameDay, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchRepaymentAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("idempotencyKey"); + openapiFields.add("sameDay"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchRepaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchRepaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchRepaymentAttributes is not found in the empty JSON string", CreateAchRepaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchRepaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchRepaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchRepaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchRepaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchRepaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchRepaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchRepaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchRepaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchRepaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchRepaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreateAchRepaymentAttributes + */ + public static CreateAchRepaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchRepaymentAttributes.class); + } + + /** + * Convert an instance of CreateAchRepaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateAchRepaymentRelationships.java b/src/main/java/org/openapitools/client/model/CreateAchRepaymentRelationships.java new file mode 100644 index 00000000..668bece8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateAchRepaymentRelationships.java @@ -0,0 +1,278 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateAchRepaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateAchRepaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public static final String SERIALIZED_NAME_CREDIT_ACCOUNT = "creditAccount"; + @SerializedName(SERIALIZED_NAME_CREDIT_ACCOUNT) + private Relationship creditAccount; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Relationship counterparty; + + public CreateAchRepaymentRelationships() { + } + + public CreateAchRepaymentRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + public CreateAchRepaymentRelationships creditAccount(Relationship creditAccount) { + + this.creditAccount = creditAccount; + return this; + } + + /** + * Get creditAccount + * @return creditAccount + **/ + @javax.annotation.Nonnull + public Relationship getCreditAccount() { + return creditAccount; + } + + + public void setCreditAccount(Relationship creditAccount) { + this.creditAccount = creditAccount; + } + + + public CreateAchRepaymentRelationships counterparty(Relationship counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public Relationship getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Relationship counterparty) { + this.counterparty = counterparty; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAchRepaymentRelationships createAchRepaymentRelationships = (CreateAchRepaymentRelationships) o; + return Objects.equals(this.account, createAchRepaymentRelationships.account) && + Objects.equals(this.creditAccount, createAchRepaymentRelationships.creditAccount) && + Objects.equals(this.counterparty, createAchRepaymentRelationships.counterparty); + } + + @Override + public int hashCode() { + return Objects.hash(account, creditAccount, counterparty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAchRepaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" creditAccount: ").append(toIndentedString(creditAccount)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("creditAccount"); + openapiFields.add("counterparty"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("creditAccount"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAchRepaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAchRepaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAchRepaymentRelationships is not found in the empty JSON string", CreateAchRepaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAchRepaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAchRepaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAchRepaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + // validate the required field `creditAccount` + Relationship.validateJsonElement(jsonObj.get("creditAccount")); + // validate the required field `counterparty` + Relationship.validateJsonElement(jsonObj.get("counterparty")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAchRepaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAchRepaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAchRepaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAchRepaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAchRepaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAchRepaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAchRepaymentRelationships + * @throws IOException if the JSON string is invalid with respect to CreateAchRepaymentRelationships + */ + public static CreateAchRepaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAchRepaymentRelationships.class); + } + + /** + * Convert an instance of CreateAchRepaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApiToken.java b/src/main/java/org/openapitools/client/model/CreateApiToken.java new file mode 100644 index 00000000..9096f4e1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApiToken.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateApiTokenAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApiToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApiToken { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "apiToken"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateApiTokenAttributes attributes; + + public CreateApiToken() { + } + + public CreateApiToken type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateApiToken attributes(CreateApiTokenAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateApiTokenAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateApiTokenAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApiToken createApiToken = (CreateApiToken) o; + return Objects.equals(this.type, createApiToken.type) && + Objects.equals(this.attributes, createApiToken.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApiToken {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApiToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApiToken.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApiToken is not found in the empty JSON string", CreateApiToken.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApiToken.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApiToken` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateApiToken.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateApiTokenAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApiToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApiToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApiToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApiToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApiToken read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApiToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApiToken + * @throws IOException if the JSON string is invalid with respect to CreateApiToken + */ + public static CreateApiToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApiToken.class); + } + + /** + * Convert an instance of CreateApiToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApiTokenAttributes.java b/src/main/java/org/openapitools/client/model/CreateApiTokenAttributes.java new file mode 100644 index 00000000..01d6efb7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApiTokenAttributes.java @@ -0,0 +1,361 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.CreateApiTokenAttributesResourcesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApiTokenAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApiTokenAttributes { + public static final String SERIALIZED_NAME_SCOPE = "scope"; + @SerializedName(SERIALIZED_NAME_SCOPE) + private String scope; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_EXPIRATION = "expiration"; + @SerializedName(SERIALIZED_NAME_EXPIRATION) + private OffsetDateTime expiration; + + public static final String SERIALIZED_NAME_SOURCE_IP = "sourceIp"; + @SerializedName(SERIALIZED_NAME_SOURCE_IP) + private String sourceIp; + + public static final String SERIALIZED_NAME_RESOURCES = "resources"; + @SerializedName(SERIALIZED_NAME_RESOURCES) + private List resources; + + public CreateApiTokenAttributes() { + } + + public CreateApiTokenAttributes scope(String scope) { + + this.scope = scope; + return this; + } + + /** + * Get scope + * @return scope + **/ + @javax.annotation.Nullable + public String getScope() { + return scope; + } + + + public void setScope(String scope) { + this.scope = scope; + } + + + public CreateApiTokenAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateApiTokenAttributes expiration(OffsetDateTime expiration) { + + this.expiration = expiration; + return this; + } + + /** + * Get expiration + * @return expiration + **/ + @javax.annotation.Nonnull + public OffsetDateTime getExpiration() { + return expiration; + } + + + public void setExpiration(OffsetDateTime expiration) { + this.expiration = expiration; + } + + + public CreateApiTokenAttributes sourceIp(String sourceIp) { + + this.sourceIp = sourceIp; + return this; + } + + /** + * Get sourceIp + * @return sourceIp + **/ + @javax.annotation.Nullable + public String getSourceIp() { + return sourceIp; + } + + + public void setSourceIp(String sourceIp) { + this.sourceIp = sourceIp; + } + + + public CreateApiTokenAttributes resources(List resources) { + + this.resources = resources; + return this; + } + + public CreateApiTokenAttributes addResourcesItem(CreateApiTokenAttributesResourcesInner resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * @return resources + **/ + @javax.annotation.Nullable + public List getResources() { + return resources; + } + + + public void setResources(List resources) { + this.resources = resources; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApiTokenAttributes createApiTokenAttributes = (CreateApiTokenAttributes) o; + return Objects.equals(this.scope, createApiTokenAttributes.scope) && + Objects.equals(this.description, createApiTokenAttributes.description) && + Objects.equals(this.expiration, createApiTokenAttributes.expiration) && + Objects.equals(this.sourceIp, createApiTokenAttributes.sourceIp) && + Objects.equals(this.resources, createApiTokenAttributes.resources); + } + + @Override + public int hashCode() { + return Objects.hash(scope, description, expiration, sourceIp, resources); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApiTokenAttributes {\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" expiration: ").append(toIndentedString(expiration)).append("\n"); + sb.append(" sourceIp: ").append(toIndentedString(sourceIp)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scope"); + openapiFields.add("description"); + openapiFields.add("expiration"); + openapiFields.add("sourceIp"); + openapiFields.add("resources"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("expiration"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApiTokenAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApiTokenAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApiTokenAttributes is not found in the empty JSON string", CreateApiTokenAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApiTokenAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApiTokenAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateApiTokenAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("sourceIp") != null && !jsonObj.get("sourceIp").isJsonNull()) && !jsonObj.get("sourceIp").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceIp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceIp").toString())); + } + if (jsonObj.get("resources") != null && !jsonObj.get("resources").isJsonNull()) { + JsonArray jsonArrayresources = jsonObj.getAsJsonArray("resources"); + if (jsonArrayresources != null) { + // ensure the json data is an array + if (!jsonObj.get("resources").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `resources` to be an array in the JSON string but got `%s`", jsonObj.get("resources").toString())); + } + + // validate the optional field `resources` (array) + for (int i = 0; i < jsonArrayresources.size(); i++) { + CreateApiTokenAttributesResourcesInner.validateJsonElement(jsonArrayresources.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApiTokenAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApiTokenAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApiTokenAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApiTokenAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApiTokenAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApiTokenAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApiTokenAttributes + * @throws IOException if the JSON string is invalid with respect to CreateApiTokenAttributes + */ + public static CreateApiTokenAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApiTokenAttributes.class); + } + + /** + * Convert an instance of CreateApiTokenAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApiTokenAttributesResourcesInner.java b/src/main/java/org/openapitools/client/model/CreateApiTokenAttributesResourcesInner.java new file mode 100644 index 00000000..e3947360 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApiTokenAttributesResourcesInner.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApiTokenAttributesResourcesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApiTokenAttributesResourcesInner { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CARD("card"), + + ACCOUNT("account"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_IDS = "ids"; + @SerializedName(SERIALIZED_NAME_IDS) + private List ids; + + public CreateApiTokenAttributesResourcesInner() { + } + + public CreateApiTokenAttributesResourcesInner type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateApiTokenAttributesResourcesInner ids(List ids) { + + this.ids = ids; + return this; + } + + public CreateApiTokenAttributesResourcesInner addIdsItem(String idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); + } + this.ids.add(idsItem); + return this; + } + + /** + * Get ids + * @return ids + **/ + @javax.annotation.Nullable + public List getIds() { + return ids; + } + + + public void setIds(List ids) { + this.ids = ids; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApiTokenAttributesResourcesInner createApiTokenAttributesResourcesInner = (CreateApiTokenAttributesResourcesInner) o; + return Objects.equals(this.type, createApiTokenAttributesResourcesInner.type) && + Objects.equals(this.ids, createApiTokenAttributesResourcesInner.ids); + } + + @Override + public int hashCode() { + return Objects.hash(type, ids); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApiTokenAttributesResourcesInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("ids"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApiTokenAttributesResourcesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApiTokenAttributesResourcesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApiTokenAttributesResourcesInner is not found in the empty JSON string", CreateApiTokenAttributesResourcesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApiTokenAttributesResourcesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApiTokenAttributesResourcesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("ids") != null && !jsonObj.get("ids").isJsonNull() && !jsonObj.get("ids").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ids` to be an array in the JSON string but got `%s`", jsonObj.get("ids").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApiTokenAttributesResourcesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApiTokenAttributesResourcesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApiTokenAttributesResourcesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApiTokenAttributesResourcesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApiTokenAttributesResourcesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApiTokenAttributesResourcesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApiTokenAttributesResourcesInner + * @throws IOException if the JSON string is invalid with respect to CreateApiTokenAttributesResourcesInner + */ + public static CreateApiTokenAttributesResourcesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApiTokenAttributesResourcesInner.class); + } + + /** + * Convert an instance of CreateApiTokenAttributesResourcesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApplication.java b/src/main/java/org/openapitools/client/model/CreateApplication.java new file mode 100644 index 00000000..f92f96c2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApplication.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateApplicationData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApplication { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateApplicationData data; + + public CreateApplication() { + } + + public CreateApplication data(CreateApplicationData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CreateApplicationData getData() { + return data; + } + + + public void setData(CreateApplicationData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApplication createApplication = (CreateApplication) o; + return Objects.equals(this.data, createApplication.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApplication {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApplication is not found in the empty JSON string", CreateApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CreateApplicationData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApplication + * @throws IOException if the JSON string is invalid with respect to CreateApplication + */ + public static CreateApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApplication.class); + } + + /** + * Convert an instance of CreateApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApplicationData.java b/src/main/java/org/openapitools/client/model/CreateApplicationData.java new file mode 100644 index 00000000..d0f3290d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApplicationData.java @@ -0,0 +1,377 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessApplication; +import org.openapitools.client.model.CreateIndividualApplication; +import org.openapitools.client.model.CreateSoleProprietorApplication; +import org.openapitools.client.model.CreateTrustApplication; +import org.openapitools.client.model.CreateTrustApplicationAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApplicationData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateApplicationData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApplicationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApplicationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateIndividualApplication = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualApplication.class)); + final TypeAdapter adapterCreateSoleProprietorApplication = gson.getDelegateAdapter(this, TypeToken.get(CreateSoleProprietorApplication.class)); + final TypeAdapter adapterCreateBusinessApplication = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessApplication.class)); + final TypeAdapter adapterCreateTrustApplication = gson.getDelegateAdapter(this, TypeToken.get(CreateTrustApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApplicationData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateIndividualApplication` + if (value.getActualInstance() instanceof CreateIndividualApplication) { + JsonElement element = adapterCreateIndividualApplication.toJsonTree((CreateIndividualApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateSoleProprietorApplication` + if (value.getActualInstance() instanceof CreateSoleProprietorApplication) { + JsonElement element = adapterCreateSoleProprietorApplication.toJsonTree((CreateSoleProprietorApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBusinessApplication` + if (value.getActualInstance() instanceof CreateBusinessApplication) { + JsonElement element = adapterCreateBusinessApplication.toJsonTree((CreateBusinessApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateTrustApplication` + if (value.getActualInstance() instanceof CreateTrustApplication) { + JsonElement element = adapterCreateTrustApplication.toJsonTree((CreateTrustApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateBusinessApplication, CreateIndividualApplication, CreateSoleProprietorApplication, CreateTrustApplication"); + } + + @Override + public CreateApplicationData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateIndividualApplication + try { + // validate the JSON object to see if any exception is thrown + CreateIndividualApplication.validateJsonElement(jsonElement); + actualAdapter = adapterCreateIndividualApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateIndividualApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateIndividualApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateIndividualApplication'", e); + } + // deserialize CreateSoleProprietorApplication + try { + // validate the JSON object to see if any exception is thrown + CreateSoleProprietorApplication.validateJsonElement(jsonElement); + actualAdapter = adapterCreateSoleProprietorApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateSoleProprietorApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateSoleProprietorApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateSoleProprietorApplication'", e); + } + // deserialize CreateBusinessApplication + try { + // validate the JSON object to see if any exception is thrown + CreateBusinessApplication.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBusinessApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBusinessApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBusinessApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBusinessApplication'", e); + } + // deserialize CreateTrustApplication + try { + // validate the JSON object to see if any exception is thrown + CreateTrustApplication.validateJsonElement(jsonElement); + actualAdapter = adapterCreateTrustApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateTrustApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateTrustApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateTrustApplication'", e); + } + + if (match == 1) { + CreateApplicationData ret = new CreateApplicationData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateApplicationData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateApplicationData() { + super("oneOf", Boolean.FALSE); + } + + public CreateApplicationData(CreateBusinessApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateApplicationData(CreateIndividualApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateApplicationData(CreateSoleProprietorApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateApplicationData(CreateTrustApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateIndividualApplication", CreateIndividualApplication.class); + schemas.put("CreateSoleProprietorApplication", CreateSoleProprietorApplication.class); + schemas.put("CreateBusinessApplication", CreateBusinessApplication.class); + schemas.put("CreateTrustApplication", CreateTrustApplication.class); + } + + @Override + public Map> getSchemas() { + return CreateApplicationData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateBusinessApplication, CreateIndividualApplication, CreateSoleProprietorApplication, CreateTrustApplication + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateIndividualApplication) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateSoleProprietorApplication) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBusinessApplication) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateTrustApplication) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateBusinessApplication, CreateIndividualApplication, CreateSoleProprietorApplication, CreateTrustApplication"); + } + + /** + * Get the actual instance, which can be the following: + * CreateBusinessApplication, CreateIndividualApplication, CreateSoleProprietorApplication, CreateTrustApplication + * + * @return The actual instance (CreateBusinessApplication, CreateIndividualApplication, CreateSoleProprietorApplication, CreateTrustApplication) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateIndividualApplication`. If the actual instance is not `CreateIndividualApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateIndividualApplication` + * @throws ClassCastException if the instance is not `CreateIndividualApplication` + */ + public CreateIndividualApplication getCreateIndividualApplication() throws ClassCastException { + return (CreateIndividualApplication)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateSoleProprietorApplication`. If the actual instance is not `CreateSoleProprietorApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateSoleProprietorApplication` + * @throws ClassCastException if the instance is not `CreateSoleProprietorApplication` + */ + public CreateSoleProprietorApplication getCreateSoleProprietorApplication() throws ClassCastException { + return (CreateSoleProprietorApplication)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBusinessApplication`. If the actual instance is not `CreateBusinessApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBusinessApplication` + * @throws ClassCastException if the instance is not `CreateBusinessApplication` + */ + public CreateBusinessApplication getCreateBusinessApplication() throws ClassCastException { + return (CreateBusinessApplication)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateTrustApplication`. If the actual instance is not `CreateTrustApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateTrustApplication` + * @throws ClassCastException if the instance is not `CreateTrustApplication` + */ + public CreateTrustApplication getCreateTrustApplication() throws ClassCastException { + return (CreateTrustApplication)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApplicationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateIndividualApplication + try { + CreateIndividualApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateIndividualApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateSoleProprietorApplication + try { + CreateSoleProprietorApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateSoleProprietorApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBusinessApplication + try { + CreateBusinessApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBusinessApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateTrustApplication + try { + CreateTrustApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateTrustApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateApplicationData with oneOf schemas: CreateBusinessApplication, CreateIndividualApplication, CreateSoleProprietorApplication, CreateTrustApplication. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateApplicationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApplicationData + * @throws IOException if the JSON string is invalid with respect to CreateApplicationData + */ + public static CreateApplicationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApplicationData.class); + } + + /** + * Convert an instance of CreateApplicationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApplicationForm.java b/src/main/java/org/openapitools/client/model/CreateApplicationForm.java new file mode 100644 index 00000000..61061b65 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApplicationForm.java @@ -0,0 +1,282 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateApplicationFormAttributes; +import org.openapitools.client.model.CreateApplicationFormRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApplicationForm + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApplicationForm { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "applicationForm"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateApplicationFormAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateApplicationFormRelationships relationships; + + public CreateApplicationForm() { + } + + public CreateApplicationForm type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateApplicationForm attributes(CreateApplicationFormAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CreateApplicationFormAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateApplicationFormAttributes attributes) { + this.attributes = attributes; + } + + + public CreateApplicationForm relationships(CreateApplicationFormRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CreateApplicationFormRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateApplicationFormRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApplicationForm createApplicationForm = (CreateApplicationForm) o; + return Objects.equals(this.type, createApplicationForm.type) && + Objects.equals(this.attributes, createApplicationForm.attributes) && + Objects.equals(this.relationships, createApplicationForm.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApplicationForm {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApplicationForm + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApplicationForm.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApplicationForm is not found in the empty JSON string", CreateApplicationForm.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApplicationForm.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApplicationForm` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateApplicationForm.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CreateApplicationFormAttributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreateApplicationFormRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApplicationForm.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApplicationForm' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApplicationForm.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApplicationForm value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApplicationForm read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApplicationForm given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApplicationForm + * @throws IOException if the JSON string is invalid with respect to CreateApplicationForm + */ + public static CreateApplicationForm fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApplicationForm.class); + } + + /** + * Convert an instance of CreateApplicationForm to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApplicationFormAttributes.java b/src/main/java/org/openapitools/client/model/CreateApplicationFormAttributes.java new file mode 100644 index 00000000..e2af787a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApplicationFormAttributes.java @@ -0,0 +1,532 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Prefilled; +import org.openapitools.client.model.RequireIdVerification; +import org.openapitools.client.model.SettingsOverride; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApplicationFormAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApplicationFormAttributes { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_APPLICANT_DETAILS = "applicantDetails"; + @SerializedName(SERIALIZED_NAME_APPLICANT_DETAILS) + private Prefilled applicantDetails; + + public static final String SERIALIZED_NAME_SETTINGS_OVERRIDE = "settingsOverride"; + @SerializedName(SERIALIZED_NAME_SETTINGS_OVERRIDE) + private SettingsOverride settingsOverride; + + public static final String SERIALIZED_NAME_REQUIRE_ID_VERIFICATION = "requireIdVerification"; + @SerializedName(SERIALIZED_NAME_REQUIRE_ID_VERIFICATION) + private RequireIdVerification requireIdVerification; + + /** + * Gets or Sets allowedApplicationTypes + */ + @JsonAdapter(AllowedApplicationTypesEnum.Adapter.class) + public enum AllowedApplicationTypesEnum { + INDIVIDUAL("Individual"), + + BUSINESS("Business"), + + SOLEPROPRIETORSHIP("SoleProprietorship"); + + private String value; + + AllowedApplicationTypesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AllowedApplicationTypesEnum fromValue(String value) { + for (AllowedApplicationTypesEnum b : AllowedApplicationTypesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AllowedApplicationTypesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AllowedApplicationTypesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AllowedApplicationTypesEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ALLOWED_APPLICATION_TYPES = "allowedApplicationTypes"; + @SerializedName(SERIALIZED_NAME_ALLOWED_APPLICATION_TYPES) + private List allowedApplicationTypes; + + /** + * Gets or Sets lang + */ + @JsonAdapter(LangEnum.Adapter.class) + public enum LangEnum { + EN("en"), + + ES("es"); + + private String value; + + LangEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LangEnum fromValue(String value) { + for (LangEnum b : LangEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LangEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LangEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LangEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_LANG = "lang"; + @SerializedName(SERIALIZED_NAME_LANG) + private LangEnum lang; + + public static final String SERIALIZED_NAME_HIDE_APPLICATION_PROGRESS_TRACKER = "hideApplicationProgressTracker"; + @SerializedName(SERIALIZED_NAME_HIDE_APPLICATION_PROGRESS_TRACKER) + private Boolean hideApplicationProgressTracker; + + public CreateApplicationFormAttributes() { + } + + public CreateApplicationFormAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateApplicationFormAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateApplicationFormAttributes applicantDetails(Prefilled applicantDetails) { + + this.applicantDetails = applicantDetails; + return this; + } + + /** + * Get applicantDetails + * @return applicantDetails + **/ + @javax.annotation.Nullable + public Prefilled getApplicantDetails() { + return applicantDetails; + } + + + public void setApplicantDetails(Prefilled applicantDetails) { + this.applicantDetails = applicantDetails; + } + + + public CreateApplicationFormAttributes settingsOverride(SettingsOverride settingsOverride) { + + this.settingsOverride = settingsOverride; + return this; + } + + /** + * Get settingsOverride + * @return settingsOverride + **/ + @javax.annotation.Nullable + public SettingsOverride getSettingsOverride() { + return settingsOverride; + } + + + public void setSettingsOverride(SettingsOverride settingsOverride) { + this.settingsOverride = settingsOverride; + } + + + public CreateApplicationFormAttributes requireIdVerification(RequireIdVerification requireIdVerification) { + + this.requireIdVerification = requireIdVerification; + return this; + } + + /** + * Get requireIdVerification + * @return requireIdVerification + **/ + @javax.annotation.Nullable + public RequireIdVerification getRequireIdVerification() { + return requireIdVerification; + } + + + public void setRequireIdVerification(RequireIdVerification requireIdVerification) { + this.requireIdVerification = requireIdVerification; + } + + + public CreateApplicationFormAttributes allowedApplicationTypes(List allowedApplicationTypes) { + + this.allowedApplicationTypes = allowedApplicationTypes; + return this; + } + + public CreateApplicationFormAttributes addAllowedApplicationTypesItem(AllowedApplicationTypesEnum allowedApplicationTypesItem) { + if (this.allowedApplicationTypes == null) { + this.allowedApplicationTypes = new ArrayList<>(); + } + this.allowedApplicationTypes.add(allowedApplicationTypesItem); + return this; + } + + /** + * Get allowedApplicationTypes + * @return allowedApplicationTypes + **/ + @javax.annotation.Nullable + public List getAllowedApplicationTypes() { + return allowedApplicationTypes; + } + + + public void setAllowedApplicationTypes(List allowedApplicationTypes) { + this.allowedApplicationTypes = allowedApplicationTypes; + } + + + public CreateApplicationFormAttributes lang(LangEnum lang) { + + this.lang = lang; + return this; + } + + /** + * Get lang + * @return lang + **/ + @javax.annotation.Nullable + public LangEnum getLang() { + return lang; + } + + + public void setLang(LangEnum lang) { + this.lang = lang; + } + + + public CreateApplicationFormAttributes hideApplicationProgressTracker(Boolean hideApplicationProgressTracker) { + + this.hideApplicationProgressTracker = hideApplicationProgressTracker; + return this; + } + + /** + * Get hideApplicationProgressTracker + * @return hideApplicationProgressTracker + **/ + @javax.annotation.Nullable + public Boolean getHideApplicationProgressTracker() { + return hideApplicationProgressTracker; + } + + + public void setHideApplicationProgressTracker(Boolean hideApplicationProgressTracker) { + this.hideApplicationProgressTracker = hideApplicationProgressTracker; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApplicationFormAttributes createApplicationFormAttributes = (CreateApplicationFormAttributes) o; + return Objects.equals(this.email, createApplicationFormAttributes.email) && + Objects.equals(this.tags, createApplicationFormAttributes.tags) && + Objects.equals(this.applicantDetails, createApplicationFormAttributes.applicantDetails) && + Objects.equals(this.settingsOverride, createApplicationFormAttributes.settingsOverride) && + Objects.equals(this.requireIdVerification, createApplicationFormAttributes.requireIdVerification) && + Objects.equals(this.allowedApplicationTypes, createApplicationFormAttributes.allowedApplicationTypes) && + Objects.equals(this.lang, createApplicationFormAttributes.lang) && + Objects.equals(this.hideApplicationProgressTracker, createApplicationFormAttributes.hideApplicationProgressTracker); + } + + @Override + public int hashCode() { + return Objects.hash(email, tags, applicantDetails, settingsOverride, requireIdVerification, allowedApplicationTypes, lang, hideApplicationProgressTracker); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApplicationFormAttributes {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" applicantDetails: ").append(toIndentedString(applicantDetails)).append("\n"); + sb.append(" settingsOverride: ").append(toIndentedString(settingsOverride)).append("\n"); + sb.append(" requireIdVerification: ").append(toIndentedString(requireIdVerification)).append("\n"); + sb.append(" allowedApplicationTypes: ").append(toIndentedString(allowedApplicationTypes)).append("\n"); + sb.append(" lang: ").append(toIndentedString(lang)).append("\n"); + sb.append(" hideApplicationProgressTracker: ").append(toIndentedString(hideApplicationProgressTracker)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("tags"); + openapiFields.add("applicantDetails"); + openapiFields.add("settingsOverride"); + openapiFields.add("requireIdVerification"); + openapiFields.add("allowedApplicationTypes"); + openapiFields.add("lang"); + openapiFields.add("hideApplicationProgressTracker"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApplicationFormAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApplicationFormAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApplicationFormAttributes is not found in the empty JSON string", CreateApplicationFormAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApplicationFormAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApplicationFormAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `applicantDetails` + if (jsonObj.get("applicantDetails") != null && !jsonObj.get("applicantDetails").isJsonNull()) { + Prefilled.validateJsonElement(jsonObj.get("applicantDetails")); + } + // validate the optional field `settingsOverride` + if (jsonObj.get("settingsOverride") != null && !jsonObj.get("settingsOverride").isJsonNull()) { + SettingsOverride.validateJsonElement(jsonObj.get("settingsOverride")); + } + // validate the optional field `requireIdVerification` + if (jsonObj.get("requireIdVerification") != null && !jsonObj.get("requireIdVerification").isJsonNull()) { + RequireIdVerification.validateJsonElement(jsonObj.get("requireIdVerification")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("allowedApplicationTypes") != null && !jsonObj.get("allowedApplicationTypes").isJsonNull() && !jsonObj.get("allowedApplicationTypes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `allowedApplicationTypes` to be an array in the JSON string but got `%s`", jsonObj.get("allowedApplicationTypes").toString())); + } + if ((jsonObj.get("lang") != null && !jsonObj.get("lang").isJsonNull()) && !jsonObj.get("lang").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lang` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lang").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApplicationFormAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApplicationFormAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApplicationFormAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApplicationFormAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApplicationFormAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApplicationFormAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApplicationFormAttributes + * @throws IOException if the JSON string is invalid with respect to CreateApplicationFormAttributes + */ + public static CreateApplicationFormAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApplicationFormAttributes.class); + } + + /** + * Convert an instance of CreateApplicationFormAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateApplicationFormRelationships.java b/src/main/java/org/openapitools/client/model/CreateApplicationFormRelationships.java new file mode 100644 index 00000000..0fe586f0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateApplicationFormRelationships.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateApplicationFormRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateApplicationFormRelationships { + public static final String SERIALIZED_NAME_APPLICATION = "application"; + @SerializedName(SERIALIZED_NAME_APPLICATION) + private Relationship application; + + public CreateApplicationFormRelationships() { + } + + public CreateApplicationFormRelationships application(Relationship application) { + + this.application = application; + return this; + } + + /** + * Get application + * @return application + **/ + @javax.annotation.Nullable + public Relationship getApplication() { + return application; + } + + + public void setApplication(Relationship application) { + this.application = application; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateApplicationFormRelationships createApplicationFormRelationships = (CreateApplicationFormRelationships) o; + return Objects.equals(this.application, createApplicationFormRelationships.application); + } + + @Override + public int hashCode() { + return Objects.hash(application); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateApplicationFormRelationships {\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("application"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateApplicationFormRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateApplicationFormRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateApplicationFormRelationships is not found in the empty JSON string", CreateApplicationFormRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateApplicationFormRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateApplicationFormRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `application` + if (jsonObj.get("application") != null && !jsonObj.get("application").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("application")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateApplicationFormRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateApplicationFormRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateApplicationFormRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateApplicationFormRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateApplicationFormRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateApplicationFormRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateApplicationFormRelationships + * @throws IOException if the JSON string is invalid with respect to CreateApplicationFormRelationships + */ + public static CreateApplicationFormRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateApplicationFormRelationships.class); + } + + /** + * Convert an instance of CreateApplicationFormRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBeneficialOwner.java b/src/main/java/org/openapitools/client/model/CreateBeneficialOwner.java new file mode 100644 index 00000000..fbe80a8b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBeneficialOwner.java @@ -0,0 +1,529 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.EvaluationParams; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBeneficialOwner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBeneficialOwner { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + private Integer percentage; + + public static final String SERIALIZED_NAME_EVALUATION_PARAMS = "evaluationParams"; + @SerializedName(SERIALIZED_NAME_EVALUATION_PARAMS) + private EvaluationParams evaluationParams; + + public CreateBeneficialOwner() { + } + + public CreateBeneficialOwner fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateBeneficialOwner email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateBeneficialOwner phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateBeneficialOwner ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreateBeneficialOwner passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreateBeneficialOwner nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreateBeneficialOwner matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public CreateBeneficialOwner address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateBeneficialOwner dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateBeneficialOwner percentage(Integer percentage) { + + this.percentage = percentage; + return this; + } + + /** + * Get percentage + * minimum: 0 + * maximum: 100 + * @return percentage + **/ + @javax.annotation.Nullable + public Integer getPercentage() { + return percentage; + } + + + public void setPercentage(Integer percentage) { + this.percentage = percentage; + } + + + public CreateBeneficialOwner evaluationParams(EvaluationParams evaluationParams) { + + this.evaluationParams = evaluationParams; + return this; + } + + /** + * Get evaluationParams + * @return evaluationParams + **/ + @javax.annotation.Nullable + public EvaluationParams getEvaluationParams() { + return evaluationParams; + } + + + public void setEvaluationParams(EvaluationParams evaluationParams) { + this.evaluationParams = evaluationParams; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBeneficialOwner createBeneficialOwner = (CreateBeneficialOwner) o; + return Objects.equals(this.fullName, createBeneficialOwner.fullName) && + Objects.equals(this.email, createBeneficialOwner.email) && + Objects.equals(this.phone, createBeneficialOwner.phone) && + Objects.equals(this.ssn, createBeneficialOwner.ssn) && + Objects.equals(this.passport, createBeneficialOwner.passport) && + Objects.equals(this.nationality, createBeneficialOwner.nationality) && + Objects.equals(this.matriculaConsular, createBeneficialOwner.matriculaConsular) && + Objects.equals(this.address, createBeneficialOwner.address) && + Objects.equals(this.dateOfBirth, createBeneficialOwner.dateOfBirth) && + Objects.equals(this.percentage, createBeneficialOwner.percentage) && + Objects.equals(this.evaluationParams, createBeneficialOwner.evaluationParams); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, percentage, evaluationParams); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBeneficialOwner {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" evaluationParams: ").append(toIndentedString(evaluationParams)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("percentage"); + openapiFields.add("evaluationParams"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBeneficialOwner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBeneficialOwner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBeneficialOwner is not found in the empty JSON string", CreateBeneficialOwner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBeneficialOwner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBeneficialOwner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBeneficialOwner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + // validate the optional field `evaluationParams` + if (jsonObj.get("evaluationParams") != null && !jsonObj.get("evaluationParams").isJsonNull()) { + EvaluationParams.validateJsonElement(jsonObj.get("evaluationParams")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBeneficialOwner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBeneficialOwner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBeneficialOwner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBeneficialOwner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBeneficialOwner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBeneficialOwner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBeneficialOwner + * @throws IOException if the JSON string is invalid with respect to CreateBeneficialOwner + */ + public static CreateBeneficialOwner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBeneficialOwner.class); + } + + /** + * Convert an instance of CreateBeneficialOwner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBillPayment.java b/src/main/java/org/openapitools/client/model/CreateBillPayment.java new file mode 100644 index 00000000..8591e3af --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBillPayment.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPaymentRelationships; +import org.openapitools.client.model.CreateBillPaymentAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBillPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBillPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "billPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBillPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchPaymentRelationships relationships; + + public CreateBillPayment() { + } + + public CreateBillPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateBillPayment attributes(CreateBillPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBillPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBillPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBillPayment relationships(CreateAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBillPayment createBillPayment = (CreateBillPayment) o; + return Objects.equals(this.type, createBillPayment.type) && + Objects.equals(this.attributes, createBillPayment.attributes) && + Objects.equals(this.relationships, createBillPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBillPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBillPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBillPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBillPayment is not found in the empty JSON string", CreateBillPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBillPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBillPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBillPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBillPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBillPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBillPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBillPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBillPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBillPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBillPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBillPayment + * @throws IOException if the JSON string is invalid with respect to CreateBillPayment + */ + public static CreateBillPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBillPayment.class); + } + + /** + * Convert an instance of CreateBillPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBillPaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreateBillPaymentAttributes.java new file mode 100644 index 00000000..b7c668c4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBillPaymentAttributes.java @@ -0,0 +1,430 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.FullName; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBillPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBillPaymentAttributes { + public static final String SERIALIZED_NAME_BILLER_ID = "billerId"; + @SerializedName(SERIALIZED_NAME_BILLER_ID) + private String billerId; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public CreateBillPaymentAttributes() { + } + + public CreateBillPaymentAttributes billerId(String billerId) { + + this.billerId = billerId; + return this; + } + + /** + * Get billerId + * @return billerId + **/ + @javax.annotation.Nonnull + public String getBillerId() { + return billerId; + } + + + public void setBillerId(String billerId) { + this.billerId = billerId; + } + + + public CreateBillPaymentAttributes accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public CreateBillPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateBillPaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateBillPaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateBillPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateBillPaymentAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateBillPaymentAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBillPaymentAttributes createBillPaymentAttributes = (CreateBillPaymentAttributes) o; + return Objects.equals(this.billerId, createBillPaymentAttributes.billerId) && + Objects.equals(this.accountNumber, createBillPaymentAttributes.accountNumber) && + Objects.equals(this.amount, createBillPaymentAttributes.amount) && + Objects.equals(this.description, createBillPaymentAttributes.description) && + Objects.equals(this.idempotencyKey, createBillPaymentAttributes.idempotencyKey) && + Objects.equals(this.tags, createBillPaymentAttributes.tags) && + Objects.equals(this.fullName, createBillPaymentAttributes.fullName) && + Objects.equals(this.dateOfBirth, createBillPaymentAttributes.dateOfBirth); + } + + @Override + public int hashCode() { + return Objects.hash(billerId, accountNumber, amount, description, idempotencyKey, tags, fullName, dateOfBirth); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBillPaymentAttributes {\n"); + sb.append(" billerId: ").append(toIndentedString(billerId)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("billerId"); + openapiFields.add("accountNumber"); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + openapiFields.add("fullName"); + openapiFields.add("dateOfBirth"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("billerId"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBillPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBillPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBillPaymentAttributes is not found in the empty JSON string", CreateBillPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBillPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBillPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBillPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("billerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `billerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("billerId").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBillPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBillPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBillPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBillPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBillPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBillPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBillPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreateBillPaymentAttributes + */ + public static CreateBillPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBillPaymentAttributes.class); + } + + /** + * Convert an instance of CreateBillPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBookPayment.java b/src/main/java/org/openapitools/client/model/CreateBookPayment.java new file mode 100644 index 00000000..1d6214fb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBookPayment.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBookPaymentAttributes; +import org.openapitools.client.model.CreateBookPaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBookPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBookPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "bookPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBookPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateBookPaymentRelationships relationships; + + public CreateBookPayment() { + } + + public CreateBookPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateBookPayment attributes(CreateBookPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBookPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBookPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBookPayment relationships(CreateBookPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateBookPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateBookPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBookPayment createBookPayment = (CreateBookPayment) o; + return Objects.equals(this.type, createBookPayment.type) && + Objects.equals(this.attributes, createBookPayment.attributes) && + Objects.equals(this.relationships, createBookPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBookPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBookPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBookPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBookPayment is not found in the empty JSON string", CreateBookPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBookPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBookPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBookPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBookPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateBookPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBookPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBookPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBookPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBookPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBookPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBookPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBookPayment + * @throws IOException if the JSON string is invalid with respect to CreateBookPayment + */ + public static CreateBookPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBookPayment.class); + } + + /** + * Convert an instance of CreateBookPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBookPaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreateBookPaymentAttributes.java new file mode 100644 index 00000000..171936bb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBookPaymentAttributes.java @@ -0,0 +1,335 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBookPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBookPaymentAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_TRANSACTION_SUMMARY_OVERRIDE = "transactionSummaryOverride"; + @SerializedName(SERIALIZED_NAME_TRANSACTION_SUMMARY_OVERRIDE) + private String transactionSummaryOverride; + + public CreateBookPaymentAttributes() { + } + + public CreateBookPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateBookPaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateBookPaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateBookPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateBookPaymentAttributes transactionSummaryOverride(String transactionSummaryOverride) { + + this.transactionSummaryOverride = transactionSummaryOverride; + return this; + } + + /** + * Get transactionSummaryOverride + * @return transactionSummaryOverride + **/ + @javax.annotation.Nullable + public String getTransactionSummaryOverride() { + return transactionSummaryOverride; + } + + + public void setTransactionSummaryOverride(String transactionSummaryOverride) { + this.transactionSummaryOverride = transactionSummaryOverride; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBookPaymentAttributes createBookPaymentAttributes = (CreateBookPaymentAttributes) o; + return Objects.equals(this.amount, createBookPaymentAttributes.amount) && + Objects.equals(this.description, createBookPaymentAttributes.description) && + Objects.equals(this.idempotencyKey, createBookPaymentAttributes.idempotencyKey) && + Objects.equals(this.tags, createBookPaymentAttributes.tags) && + Objects.equals(this.transactionSummaryOverride, createBookPaymentAttributes.transactionSummaryOverride); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, idempotencyKey, tags, transactionSummaryOverride); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBookPaymentAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" transactionSummaryOverride: ").append(toIndentedString(transactionSummaryOverride)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + openapiFields.add("transactionSummaryOverride"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBookPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBookPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBookPaymentAttributes is not found in the empty JSON string", CreateBookPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBookPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBookPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBookPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if ((jsonObj.get("transactionSummaryOverride") != null && !jsonObj.get("transactionSummaryOverride").isJsonNull()) && !jsonObj.get("transactionSummaryOverride").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transactionSummaryOverride` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transactionSummaryOverride").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBookPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBookPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBookPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBookPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBookPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBookPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBookPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreateBookPaymentAttributes + */ + public static CreateBookPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBookPaymentAttributes.class); + } + + /** + * Convert an instance of CreateBookPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBookPaymentRelationships.java b/src/main/java/org/openapitools/client/model/CreateBookPaymentRelationships.java new file mode 100644 index 00000000..46f12dc4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBookPaymentRelationships.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationship; +import org.openapitools.client.model.CounterpartyAccountRelationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBookPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBookPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AccountRelationship account; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT = "counterpartyAccount"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT) + private CounterpartyAccountRelationship counterpartyAccount; + + public CreateBookPaymentRelationships() { + } + + public CreateBookPaymentRelationships account(AccountRelationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public AccountRelationship getAccount() { + return account; + } + + + public void setAccount(AccountRelationship account) { + this.account = account; + } + + + public CreateBookPaymentRelationships counterpartyAccount(CounterpartyAccountRelationship counterpartyAccount) { + + this.counterpartyAccount = counterpartyAccount; + return this; + } + + /** + * Get counterpartyAccount + * @return counterpartyAccount + **/ + @javax.annotation.Nonnull + public CounterpartyAccountRelationship getCounterpartyAccount() { + return counterpartyAccount; + } + + + public void setCounterpartyAccount(CounterpartyAccountRelationship counterpartyAccount) { + this.counterpartyAccount = counterpartyAccount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBookPaymentRelationships createBookPaymentRelationships = (CreateBookPaymentRelationships) o; + return Objects.equals(this.account, createBookPaymentRelationships.account) && + Objects.equals(this.counterpartyAccount, createBookPaymentRelationships.counterpartyAccount); + } + + @Override + public int hashCode() { + return Objects.hash(account, counterpartyAccount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBookPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" counterpartyAccount: ").append(toIndentedString(counterpartyAccount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("counterpartyAccount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("counterpartyAccount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBookPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBookPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBookPaymentRelationships is not found in the empty JSON string", CreateBookPaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBookPaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBookPaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBookPaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + AccountRelationship.validateJsonElement(jsonObj.get("account")); + // validate the required field `counterpartyAccount` + CounterpartyAccountRelationship.validateJsonElement(jsonObj.get("counterpartyAccount")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBookPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBookPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBookPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBookPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBookPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBookPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBookPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to CreateBookPaymentRelationships + */ + public static CreateBookPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBookPaymentRelationships.class); + } + + /** + * Convert an instance of CreateBookPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBookRepayment.java b/src/main/java/org/openapitools/client/model/CreateBookRepayment.java new file mode 100644 index 00000000..4fd32aa3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBookRepayment.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBookRepaymentAttributes; +import org.openapitools.client.model.CreateBookRepaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBookRepayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBookRepayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "bookRepayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBookRepaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateBookRepaymentRelationships relationships; + + public CreateBookRepayment() { + } + + public CreateBookRepayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateBookRepayment attributes(CreateBookRepaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBookRepaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBookRepaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBookRepayment relationships(CreateBookRepaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateBookRepaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateBookRepaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBookRepayment createBookRepayment = (CreateBookRepayment) o; + return Objects.equals(this.type, createBookRepayment.type) && + Objects.equals(this.attributes, createBookRepayment.attributes) && + Objects.equals(this.relationships, createBookRepayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBookRepayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBookRepayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBookRepayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBookRepayment is not found in the empty JSON string", CreateBookRepayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBookRepayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBookRepayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBookRepayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBookRepaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateBookRepaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBookRepayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBookRepayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBookRepayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBookRepayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBookRepayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBookRepayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBookRepayment + * @throws IOException if the JSON string is invalid with respect to CreateBookRepayment + */ + public static CreateBookRepayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBookRepayment.class); + } + + /** + * Convert an instance of CreateBookRepayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBookRepaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreateBookRepaymentAttributes.java new file mode 100644 index 00000000..174942ea --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBookRepaymentAttributes.java @@ -0,0 +1,336 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBookRepaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBookRepaymentAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_TRANSACTION_SUMMARY_OVERRIDE = "transactionSummaryOverride"; + @SerializedName(SERIALIZED_NAME_TRANSACTION_SUMMARY_OVERRIDE) + private String transactionSummaryOverride; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CreateBookRepaymentAttributes() { + } + + public CreateBookRepaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateBookRepaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateBookRepaymentAttributes transactionSummaryOverride(String transactionSummaryOverride) { + + this.transactionSummaryOverride = transactionSummaryOverride; + return this; + } + + /** + * Get transactionSummaryOverride + * @return transactionSummaryOverride + **/ + @javax.annotation.Nullable + public String getTransactionSummaryOverride() { + return transactionSummaryOverride; + } + + + public void setTransactionSummaryOverride(String transactionSummaryOverride) { + this.transactionSummaryOverride = transactionSummaryOverride; + } + + + public CreateBookRepaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateBookRepaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBookRepaymentAttributes createBookRepaymentAttributes = (CreateBookRepaymentAttributes) o; + return Objects.equals(this.amount, createBookRepaymentAttributes.amount) && + Objects.equals(this.description, createBookRepaymentAttributes.description) && + Objects.equals(this.transactionSummaryOverride, createBookRepaymentAttributes.transactionSummaryOverride) && + Objects.equals(this.idempotencyKey, createBookRepaymentAttributes.idempotencyKey) && + Objects.equals(this.tags, createBookRepaymentAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, transactionSummaryOverride, idempotencyKey, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBookRepaymentAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" transactionSummaryOverride: ").append(toIndentedString(transactionSummaryOverride)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("transactionSummaryOverride"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBookRepaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBookRepaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBookRepaymentAttributes is not found in the empty JSON string", CreateBookRepaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBookRepaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBookRepaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBookRepaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("transactionSummaryOverride") != null && !jsonObj.get("transactionSummaryOverride").isJsonNull()) && !jsonObj.get("transactionSummaryOverride").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transactionSummaryOverride` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transactionSummaryOverride").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBookRepaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBookRepaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBookRepaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBookRepaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBookRepaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBookRepaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBookRepaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreateBookRepaymentAttributes + */ + public static CreateBookRepaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBookRepaymentAttributes.class); + } + + /** + * Convert an instance of CreateBookRepaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBookRepaymentRelationships.java b/src/main/java/org/openapitools/client/model/CreateBookRepaymentRelationships.java new file mode 100644 index 00000000..b2d5554b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBookRepaymentRelationships.java @@ -0,0 +1,278 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBookRepaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBookRepaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public static final String SERIALIZED_NAME_CREDIT_ACCOUNT = "creditAccount"; + @SerializedName(SERIALIZED_NAME_CREDIT_ACCOUNT) + private Relationship creditAccount; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT = "counterpartyAccount"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT) + private Relationship counterpartyAccount; + + public CreateBookRepaymentRelationships() { + } + + public CreateBookRepaymentRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + public CreateBookRepaymentRelationships creditAccount(Relationship creditAccount) { + + this.creditAccount = creditAccount; + return this; + } + + /** + * Get creditAccount + * @return creditAccount + **/ + @javax.annotation.Nonnull + public Relationship getCreditAccount() { + return creditAccount; + } + + + public void setCreditAccount(Relationship creditAccount) { + this.creditAccount = creditAccount; + } + + + public CreateBookRepaymentRelationships counterpartyAccount(Relationship counterpartyAccount) { + + this.counterpartyAccount = counterpartyAccount; + return this; + } + + /** + * Get counterpartyAccount + * @return counterpartyAccount + **/ + @javax.annotation.Nonnull + public Relationship getCounterpartyAccount() { + return counterpartyAccount; + } + + + public void setCounterpartyAccount(Relationship counterpartyAccount) { + this.counterpartyAccount = counterpartyAccount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBookRepaymentRelationships createBookRepaymentRelationships = (CreateBookRepaymentRelationships) o; + return Objects.equals(this.account, createBookRepaymentRelationships.account) && + Objects.equals(this.creditAccount, createBookRepaymentRelationships.creditAccount) && + Objects.equals(this.counterpartyAccount, createBookRepaymentRelationships.counterpartyAccount); + } + + @Override + public int hashCode() { + return Objects.hash(account, creditAccount, counterpartyAccount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBookRepaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" creditAccount: ").append(toIndentedString(creditAccount)).append("\n"); + sb.append(" counterpartyAccount: ").append(toIndentedString(counterpartyAccount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("creditAccount"); + openapiFields.add("counterpartyAccount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("creditAccount"); + openapiRequiredFields.add("counterpartyAccount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBookRepaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBookRepaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBookRepaymentRelationships is not found in the empty JSON string", CreateBookRepaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBookRepaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBookRepaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBookRepaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + // validate the required field `creditAccount` + Relationship.validateJsonElement(jsonObj.get("creditAccount")); + // validate the required field `counterpartyAccount` + Relationship.validateJsonElement(jsonObj.get("counterpartyAccount")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBookRepaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBookRepaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBookRepaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBookRepaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBookRepaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBookRepaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBookRepaymentRelationships + * @throws IOException if the JSON string is invalid with respect to CreateBookRepaymentRelationships + */ + public static CreateBookRepaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBookRepaymentRelationships.class); + } + + /** + * Convert an instance of CreateBookRepaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessApplication.java b/src/main/java/org/openapitools/client/model/CreateBusinessApplication.java new file mode 100644 index 00000000..0c9a35d1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "businessApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBusinessApplicationAttributes attributes; + + public CreateBusinessApplication() { + } + + public CreateBusinessApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateBusinessApplication attributes(CreateBusinessApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBusinessApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBusinessApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessApplication createBusinessApplication = (CreateBusinessApplication) o; + return Objects.equals(this.type, createBusinessApplication.type) && + Objects.equals(this.attributes, createBusinessApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessApplication is not found in the empty JSON string", CreateBusinessApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBusinessApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessApplication + * @throws IOException if the JSON string is invalid with respect to CreateBusinessApplication + */ + public static CreateBusinessApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessApplication.class); + } + + /** + * Convert an instance of CreateBusinessApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessApplicationAttributes.java b/src/main/java/org/openapitools/client/model/CreateBusinessApplicationAttributes.java new file mode 100644 index 00000000..608c233e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessApplicationAttributes.java @@ -0,0 +1,998 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.BusinessAnnualRevenue; +import org.openapitools.client.model.BusinessNumberOfEmployees; +import org.openapitools.client.model.BusinessVertical; +import org.openapitools.client.model.CashFlow; +import org.openapitools.client.model.Contact; +import org.openapitools.client.model.CreateBeneficialOwner; +import org.openapitools.client.model.CreateOfficer; +import org.openapitools.client.model.DeviceFingerprint; +import org.openapitools.client.model.EntityType; +import org.openapitools.client.model.Industry; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessApplicationAttributes { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_ENTITY_TYPE = "entityType"; + @SerializedName(SERIALIZED_NAME_ENTITY_TYPE) + private EntityType entityType; + + public static final String SERIALIZED_NAME_DATE_OF_INCORPORATION = "dateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_DATE_OF_INCORPORATION) + private LocalDate dateOfIncorporation; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_PURPOSE = "purpose"; + @SerializedName(SERIALIZED_NAME_PURPOSE) + private String purpose; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private Contact contact; + + public static final String SERIALIZED_NAME_OFFICER = "officer"; + @SerializedName(SERIALIZED_NAME_OFFICER) + private CreateOfficer officer; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; + + public static final String SERIALIZED_NAME_BENEFICIAL_OWNERS = "beneficialOwners"; + @SerializedName(SERIALIZED_NAME_BENEFICIAL_OWNERS) + private List beneficialOwners = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_DEVICE_FINGERPRINTS = "deviceFingerprints"; + @SerializedName(SERIALIZED_NAME_DEVICE_FINGERPRINTS) + private List deviceFingerprints; + + public static final String SERIALIZED_NAME_INDUSTRY = "industry"; + @SerializedName(SERIALIZED_NAME_INDUSTRY) + private Industry industry; + + public static final String SERIALIZED_NAME_ANNUAL_REVENUE = "annualRevenue"; + @SerializedName(SERIALIZED_NAME_ANNUAL_REVENUE) + private BusinessAnnualRevenue annualRevenue; + + public static final String SERIALIZED_NAME_NUMBER_OF_EMPLOYEES = "numberOfEmployees"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_EMPLOYEES) + private BusinessNumberOfEmployees numberOfEmployees; + + public static final String SERIALIZED_NAME_CASH_FLOW = "cashFlow"; + @SerializedName(SERIALIZED_NAME_CASH_FLOW) + private CashFlow cashFlow; + + public static final String SERIALIZED_NAME_YEAR_OF_INCORPORATION = "yearOfIncorporation"; + @SerializedName(SERIALIZED_NAME_YEAR_OF_INCORPORATION) + private String yearOfIncorporation; + + public static final String SERIALIZED_NAME_COUNTRIES_OF_OPERATION = "countriesOfOperation"; + @SerializedName(SERIALIZED_NAME_COUNTRIES_OF_OPERATION) + private List countriesOfOperation; + + public static final String SERIALIZED_NAME_STOCK_SYMBOL = "stockSymbol"; + @SerializedName(SERIALIZED_NAME_STOCK_SYMBOL) + private String stockSymbol; + + public static final String SERIALIZED_NAME_BUSINESS_VERTICAL = "businessVertical"; + @SerializedName(SERIALIZED_NAME_BUSINESS_VERTICAL) + private BusinessVertical businessVertical; + + public CreateBusinessApplicationAttributes() { + } + + public CreateBusinessApplicationAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CreateBusinessApplicationAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public CreateBusinessApplicationAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nonnull + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public CreateBusinessApplicationAttributes entityType(EntityType entityType) { + + this.entityType = entityType; + return this; + } + + /** + * Get entityType + * @return entityType + **/ + @javax.annotation.Nonnull + public EntityType getEntityType() { + return entityType; + } + + + public void setEntityType(EntityType entityType) { + this.entityType = entityType; + } + + + public CreateBusinessApplicationAttributes dateOfIncorporation(LocalDate dateOfIncorporation) { + + this.dateOfIncorporation = dateOfIncorporation; + return this; + } + + /** + * Get dateOfIncorporation + * @return dateOfIncorporation + **/ + @javax.annotation.Nullable + public LocalDate getDateOfIncorporation() { + return dateOfIncorporation; + } + + + public void setDateOfIncorporation(LocalDate dateOfIncorporation) { + this.dateOfIncorporation = dateOfIncorporation; + } + + + public CreateBusinessApplicationAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nonnull + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public CreateBusinessApplicationAttributes purpose(String purpose) { + + this.purpose = purpose; + return this; + } + + /** + * Get purpose + * @return purpose + **/ + @javax.annotation.Nullable + public String getPurpose() { + return purpose; + } + + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + + public CreateBusinessApplicationAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateBusinessApplicationAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateBusinessApplicationAttributes contact(Contact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nonnull + public Contact getContact() { + return contact; + } + + + public void setContact(Contact contact) { + this.contact = contact; + } + + + public CreateBusinessApplicationAttributes officer(CreateOfficer officer) { + + this.officer = officer; + return this; + } + + /** + * Get officer + * @return officer + **/ + @javax.annotation.Nonnull + public CreateOfficer getOfficer() { + return officer; + } + + + public void setOfficer(CreateOfficer officer) { + this.officer = officer; + } + + + public CreateBusinessApplicationAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public CreateBusinessApplicationAttributes website(String website) { + + this.website = website; + return this; + } + + /** + * Get website + * @return website + **/ + @javax.annotation.Nullable + public String getWebsite() { + return website; + } + + + public void setWebsite(String website) { + this.website = website; + } + + + public CreateBusinessApplicationAttributes beneficialOwners(List beneficialOwners) { + + this.beneficialOwners = beneficialOwners; + return this; + } + + public CreateBusinessApplicationAttributes addBeneficialOwnersItem(CreateBeneficialOwner beneficialOwnersItem) { + if (this.beneficialOwners == null) { + this.beneficialOwners = new ArrayList<>(); + } + this.beneficialOwners.add(beneficialOwnersItem); + return this; + } + + /** + * Get beneficialOwners + * @return beneficialOwners + **/ + @javax.annotation.Nonnull + public List getBeneficialOwners() { + return beneficialOwners; + } + + + public void setBeneficialOwners(List beneficialOwners) { + this.beneficialOwners = beneficialOwners; + } + + + public CreateBusinessApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateBusinessApplicationAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateBusinessApplicationAttributes deviceFingerprints(List deviceFingerprints) { + + this.deviceFingerprints = deviceFingerprints; + return this; + } + + public CreateBusinessApplicationAttributes addDeviceFingerprintsItem(DeviceFingerprint deviceFingerprintsItem) { + if (this.deviceFingerprints == null) { + this.deviceFingerprints = new ArrayList<>(); + } + this.deviceFingerprints.add(deviceFingerprintsItem); + return this; + } + + /** + * Get deviceFingerprints + * @return deviceFingerprints + **/ + @javax.annotation.Nullable + public List getDeviceFingerprints() { + return deviceFingerprints; + } + + + public void setDeviceFingerprints(List deviceFingerprints) { + this.deviceFingerprints = deviceFingerprints; + } + + + public CreateBusinessApplicationAttributes industry(Industry industry) { + + this.industry = industry; + return this; + } + + /** + * Get industry + * @return industry + **/ + @javax.annotation.Nullable + public Industry getIndustry() { + return industry; + } + + + public void setIndustry(Industry industry) { + this.industry = industry; + } + + + public CreateBusinessApplicationAttributes annualRevenue(BusinessAnnualRevenue annualRevenue) { + + this.annualRevenue = annualRevenue; + return this; + } + + /** + * Get annualRevenue + * @return annualRevenue + **/ + @javax.annotation.Nullable + public BusinessAnnualRevenue getAnnualRevenue() { + return annualRevenue; + } + + + public void setAnnualRevenue(BusinessAnnualRevenue annualRevenue) { + this.annualRevenue = annualRevenue; + } + + + public CreateBusinessApplicationAttributes numberOfEmployees(BusinessNumberOfEmployees numberOfEmployees) { + + this.numberOfEmployees = numberOfEmployees; + return this; + } + + /** + * Get numberOfEmployees + * @return numberOfEmployees + **/ + @javax.annotation.Nullable + public BusinessNumberOfEmployees getNumberOfEmployees() { + return numberOfEmployees; + } + + + public void setNumberOfEmployees(BusinessNumberOfEmployees numberOfEmployees) { + this.numberOfEmployees = numberOfEmployees; + } + + + public CreateBusinessApplicationAttributes cashFlow(CashFlow cashFlow) { + + this.cashFlow = cashFlow; + return this; + } + + /** + * Get cashFlow + * @return cashFlow + **/ + @javax.annotation.Nullable + public CashFlow getCashFlow() { + return cashFlow; + } + + + public void setCashFlow(CashFlow cashFlow) { + this.cashFlow = cashFlow; + } + + + public CreateBusinessApplicationAttributes yearOfIncorporation(String yearOfIncorporation) { + + this.yearOfIncorporation = yearOfIncorporation; + return this; + } + + /** + * Get yearOfIncorporation + * @return yearOfIncorporation + **/ + @javax.annotation.Nullable + public String getYearOfIncorporation() { + return yearOfIncorporation; + } + + + public void setYearOfIncorporation(String yearOfIncorporation) { + this.yearOfIncorporation = yearOfIncorporation; + } + + + public CreateBusinessApplicationAttributes countriesOfOperation(List countriesOfOperation) { + + this.countriesOfOperation = countriesOfOperation; + return this; + } + + public CreateBusinessApplicationAttributes addCountriesOfOperationItem(String countriesOfOperationItem) { + if (this.countriesOfOperation == null) { + this.countriesOfOperation = new ArrayList<>(); + } + this.countriesOfOperation.add(countriesOfOperationItem); + return this; + } + + /** + * Get countriesOfOperation + * @return countriesOfOperation + **/ + @javax.annotation.Nullable + public List getCountriesOfOperation() { + return countriesOfOperation; + } + + + public void setCountriesOfOperation(List countriesOfOperation) { + this.countriesOfOperation = countriesOfOperation; + } + + + public CreateBusinessApplicationAttributes stockSymbol(String stockSymbol) { + + this.stockSymbol = stockSymbol; + return this; + } + + /** + * Get stockSymbol + * @return stockSymbol + **/ + @javax.annotation.Nullable + public String getStockSymbol() { + return stockSymbol; + } + + + public void setStockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + } + + + public CreateBusinessApplicationAttributes businessVertical(BusinessVertical businessVertical) { + + this.businessVertical = businessVertical; + return this; + } + + /** + * Get businessVertical + * @return businessVertical + **/ + @javax.annotation.Nullable + public BusinessVertical getBusinessVertical() { + return businessVertical; + } + + + public void setBusinessVertical(BusinessVertical businessVertical) { + this.businessVertical = businessVertical; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessApplicationAttributes createBusinessApplicationAttributes = (CreateBusinessApplicationAttributes) o; + return Objects.equals(this.name, createBusinessApplicationAttributes.name) && + Objects.equals(this.dba, createBusinessApplicationAttributes.dba) && + Objects.equals(this.ein, createBusinessApplicationAttributes.ein) && + Objects.equals(this.entityType, createBusinessApplicationAttributes.entityType) && + Objects.equals(this.dateOfIncorporation, createBusinessApplicationAttributes.dateOfIncorporation) && + Objects.equals(this.stateOfIncorporation, createBusinessApplicationAttributes.stateOfIncorporation) && + Objects.equals(this.purpose, createBusinessApplicationAttributes.purpose) && + Objects.equals(this.phone, createBusinessApplicationAttributes.phone) && + Objects.equals(this.address, createBusinessApplicationAttributes.address) && + Objects.equals(this.contact, createBusinessApplicationAttributes.contact) && + Objects.equals(this.officer, createBusinessApplicationAttributes.officer) && + Objects.equals(this.ip, createBusinessApplicationAttributes.ip) && + Objects.equals(this.website, createBusinessApplicationAttributes.website) && + Objects.equals(this.beneficialOwners, createBusinessApplicationAttributes.beneficialOwners) && + Objects.equals(this.tags, createBusinessApplicationAttributes.tags) && + Objects.equals(this.idempotencyKey, createBusinessApplicationAttributes.idempotencyKey) && + Objects.equals(this.deviceFingerprints, createBusinessApplicationAttributes.deviceFingerprints) && + Objects.equals(this.industry, createBusinessApplicationAttributes.industry) && + Objects.equals(this.annualRevenue, createBusinessApplicationAttributes.annualRevenue) && + Objects.equals(this.numberOfEmployees, createBusinessApplicationAttributes.numberOfEmployees) && + Objects.equals(this.cashFlow, createBusinessApplicationAttributes.cashFlow) && + Objects.equals(this.yearOfIncorporation, createBusinessApplicationAttributes.yearOfIncorporation) && + Objects.equals(this.countriesOfOperation, createBusinessApplicationAttributes.countriesOfOperation) && + Objects.equals(this.stockSymbol, createBusinessApplicationAttributes.stockSymbol) && + Objects.equals(this.businessVertical, createBusinessApplicationAttributes.businessVertical); + } + + @Override + public int hashCode() { + return Objects.hash(name, dba, ein, entityType, dateOfIncorporation, stateOfIncorporation, purpose, phone, address, contact, officer, ip, website, beneficialOwners, tags, idempotencyKey, deviceFingerprints, industry, annualRevenue, numberOfEmployees, cashFlow, yearOfIncorporation, countriesOfOperation, stockSymbol, businessVertical); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessApplicationAttributes {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); + sb.append(" dateOfIncorporation: ").append(toIndentedString(dateOfIncorporation)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" purpose: ").append(toIndentedString(purpose)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" officer: ").append(toIndentedString(officer)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append(" beneficialOwners: ").append(toIndentedString(beneficialOwners)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" deviceFingerprints: ").append(toIndentedString(deviceFingerprints)).append("\n"); + sb.append(" industry: ").append(toIndentedString(industry)).append("\n"); + sb.append(" annualRevenue: ").append(toIndentedString(annualRevenue)).append("\n"); + sb.append(" numberOfEmployees: ").append(toIndentedString(numberOfEmployees)).append("\n"); + sb.append(" cashFlow: ").append(toIndentedString(cashFlow)).append("\n"); + sb.append(" yearOfIncorporation: ").append(toIndentedString(yearOfIncorporation)).append("\n"); + sb.append(" countriesOfOperation: ").append(toIndentedString(countriesOfOperation)).append("\n"); + sb.append(" stockSymbol: ").append(toIndentedString(stockSymbol)).append("\n"); + sb.append(" businessVertical: ").append(toIndentedString(businessVertical)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("entityType"); + openapiFields.add("dateOfIncorporation"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("purpose"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("contact"); + openapiFields.add("officer"); + openapiFields.add("ip"); + openapiFields.add("website"); + openapiFields.add("beneficialOwners"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + openapiFields.add("deviceFingerprints"); + openapiFields.add("industry"); + openapiFields.add("annualRevenue"); + openapiFields.add("numberOfEmployees"); + openapiFields.add("cashFlow"); + openapiFields.add("yearOfIncorporation"); + openapiFields.add("countriesOfOperation"); + openapiFields.add("stockSymbol"); + openapiFields.add("businessVertical"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("ein"); + openapiRequiredFields.add("entityType"); + openapiRequiredFields.add("stateOfIncorporation"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("contact"); + openapiRequiredFields.add("officer"); + openapiRequiredFields.add("beneficialOwners"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessApplicationAttributes is not found in the empty JSON string", CreateBusinessApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessApplicationAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if (!jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if (!jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + if ((jsonObj.get("purpose") != null && !jsonObj.get("purpose").isJsonNull()) && !jsonObj.get("purpose").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `purpose` to be a primitive type in the JSON string but got `%s`", jsonObj.get("purpose").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + // validate the required field `contact` + Contact.validateJsonElement(jsonObj.get("contact")); + // validate the required field `officer` + CreateOfficer.validateJsonElement(jsonObj.get("officer")); + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `website` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("beneficialOwners").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficialOwners` to be an array in the JSON string but got `%s`", jsonObj.get("beneficialOwners").toString())); + } + + JsonArray jsonArraybeneficialOwners = jsonObj.getAsJsonArray("beneficialOwners"); + // validate the required field `beneficialOwners` (array) + for (int i = 0; i < jsonArraybeneficialOwners.size(); i++) { + CreateBeneficialOwner.validateJsonElement(jsonArraybeneficialOwners.get(i)); + }; + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if (jsonObj.get("deviceFingerprints") != null && !jsonObj.get("deviceFingerprints").isJsonNull()) { + JsonArray jsonArraydeviceFingerprints = jsonObj.getAsJsonArray("deviceFingerprints"); + if (jsonArraydeviceFingerprints != null) { + // ensure the json data is an array + if (!jsonObj.get("deviceFingerprints").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `deviceFingerprints` to be an array in the JSON string but got `%s`", jsonObj.get("deviceFingerprints").toString())); + } + + // validate the optional field `deviceFingerprints` (array) + for (int i = 0; i < jsonArraydeviceFingerprints.size(); i++) { + DeviceFingerprint.validateJsonElement(jsonArraydeviceFingerprints.get(i)); + }; + } + } + if ((jsonObj.get("yearOfIncorporation") != null && !jsonObj.get("yearOfIncorporation").isJsonNull()) && !jsonObj.get("yearOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `yearOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yearOfIncorporation").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("countriesOfOperation") != null && !jsonObj.get("countriesOfOperation").isJsonNull() && !jsonObj.get("countriesOfOperation").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `countriesOfOperation` to be an array in the JSON string but got `%s`", jsonObj.get("countriesOfOperation").toString())); + } + if ((jsonObj.get("stockSymbol") != null && !jsonObj.get("stockSymbol").isJsonNull()) && !jsonObj.get("stockSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stockSymbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stockSymbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to CreateBusinessApplicationAttributes + */ + public static CreateBusinessApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessApplicationAttributes.class); + } + + /** + * Convert an instance of CreateBusinessApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessCreditCard.java b/src/main/java/org/openapitools/client/model/CreateBusinessCreditCard.java new file mode 100644 index 00000000..5a887080 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessCreditCard.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessDebitCardAttributes; +import org.openapitools.client.model.CreateCardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessCreditCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessCreditCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSCREDITCARD("businessCreditCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.BUSINESSCREDITCARD; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBusinessDebitCardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCardRelationships relationships; + + public CreateBusinessCreditCard() { + } + + public CreateBusinessCreditCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateBusinessCreditCard attributes(CreateBusinessDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBusinessDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBusinessDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBusinessCreditCard relationships(CreateCardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessCreditCard createBusinessCreditCard = (CreateBusinessCreditCard) o; + return Objects.equals(this.type, createBusinessCreditCard.type) && + Objects.equals(this.attributes, createBusinessCreditCard.attributes) && + Objects.equals(this.relationships, createBusinessCreditCard.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessCreditCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessCreditCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessCreditCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessCreditCard is not found in the empty JSON string", CreateBusinessCreditCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessCreditCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessCreditCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessCreditCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBusinessDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessCreditCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessCreditCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessCreditCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessCreditCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessCreditCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessCreditCard + * @throws IOException if the JSON string is invalid with respect to CreateBusinessCreditCard + */ + public static CreateBusinessCreditCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessCreditCard.class); + } + + /** + * Convert an instance of CreateBusinessCreditCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessDebitCard.java b/src/main/java/org/openapitools/client/model/CreateBusinessDebitCard.java new file mode 100644 index 00000000..6dbb429f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessDebitCard.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessDebitCardAttributes; +import org.openapitools.client.model.CreateCardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSDEBITCARD("businessDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.BUSINESSDEBITCARD; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBusinessDebitCardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCardRelationships relationships; + + public CreateBusinessDebitCard() { + } + + public CreateBusinessDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateBusinessDebitCard attributes(CreateBusinessDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBusinessDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBusinessDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBusinessDebitCard relationships(CreateCardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessDebitCard createBusinessDebitCard = (CreateBusinessDebitCard) o; + return Objects.equals(this.type, createBusinessDebitCard.type) && + Objects.equals(this.attributes, createBusinessDebitCard.attributes) && + Objects.equals(this.relationships, createBusinessDebitCard.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessDebitCard is not found in the empty JSON string", CreateBusinessDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBusinessDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessDebitCard + * @throws IOException if the JSON string is invalid with respect to CreateBusinessDebitCard + */ + public static CreateBusinessDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessDebitCard.class); + } + + /** + * Convert an instance of CreateBusinessDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/CreateBusinessDebitCardAttributes.java new file mode 100644 index 00000000..94c8c7cf --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessDebitCardAttributes.java @@ -0,0 +1,708 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.CardLevelLimits; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessDebitCardAttributes { + public static final String SERIALIZED_NAME_SHIPPING_ADDRESS = "shippingAddress"; + @SerializedName(SERIALIZED_NAME_SHIPPING_ADDRESS) + private Address shippingAddress; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_DESIGN = "design"; + @SerializedName(SERIALIZED_NAME_DESIGN) + private String design; + + public static final String SERIALIZED_NAME_ADDITIONAL_EMBOSSED_TEXT = "additionalEmbossedText"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_EMBOSSED_TEXT) + private String additionalEmbossedText; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_ACTIVE_FOR_ONLINE_USE = "activeForOnlineUse"; + @SerializedName(SERIALIZED_NAME_ACTIVE_FOR_ONLINE_USE) + private Boolean activeForOnlineUse; + + public static final String SERIALIZED_NAME_PRINT_ONLY_BUSINESS_NAME = "printOnlyBusinessName"; + @SerializedName(SERIALIZED_NAME_PRINT_ONLY_BUSINESS_NAME) + private Boolean printOnlyBusinessName; + + public static final String SERIALIZED_NAME_EXPIRY_DATE = "expiryDate"; + @SerializedName(SERIALIZED_NAME_EXPIRY_DATE) + private String expiryDate; + + public CreateBusinessDebitCardAttributes() { + } + + public CreateBusinessDebitCardAttributes shippingAddress(Address shippingAddress) { + + this.shippingAddress = shippingAddress; + return this; + } + + /** + * Get shippingAddress + * @return shippingAddress + **/ + @javax.annotation.Nullable + public Address getShippingAddress() { + return shippingAddress; + } + + + public void setShippingAddress(Address shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public CreateBusinessDebitCardAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateBusinessDebitCardAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateBusinessDebitCardAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateBusinessDebitCardAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateBusinessDebitCardAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateBusinessDebitCardAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreateBusinessDebitCardAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreateBusinessDebitCardAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreateBusinessDebitCardAttributes design(String design) { + + this.design = design; + return this; + } + + /** + * Get design + * @return design + **/ + @javax.annotation.Nullable + public String getDesign() { + return design; + } + + + public void setDesign(String design) { + this.design = design; + } + + + public CreateBusinessDebitCardAttributes additionalEmbossedText(String additionalEmbossedText) { + + this.additionalEmbossedText = additionalEmbossedText; + return this; + } + + /** + * Get additionalEmbossedText + * @return additionalEmbossedText + **/ + @javax.annotation.Nullable + public String getAdditionalEmbossedText() { + return additionalEmbossedText; + } + + + public void setAdditionalEmbossedText(String additionalEmbossedText) { + this.additionalEmbossedText = additionalEmbossedText; + } + + + public CreateBusinessDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateBusinessDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public CreateBusinessDebitCardAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateBusinessDebitCardAttributes activeForOnlineUse(Boolean activeForOnlineUse) { + + this.activeForOnlineUse = activeForOnlineUse; + return this; + } + + /** + * Get activeForOnlineUse + * @return activeForOnlineUse + **/ + @javax.annotation.Nullable + public Boolean getActiveForOnlineUse() { + return activeForOnlineUse; + } + + + public void setActiveForOnlineUse(Boolean activeForOnlineUse) { + this.activeForOnlineUse = activeForOnlineUse; + } + + + public CreateBusinessDebitCardAttributes printOnlyBusinessName(Boolean printOnlyBusinessName) { + + this.printOnlyBusinessName = printOnlyBusinessName; + return this; + } + + /** + * Get printOnlyBusinessName + * @return printOnlyBusinessName + **/ + @javax.annotation.Nullable + public Boolean getPrintOnlyBusinessName() { + return printOnlyBusinessName; + } + + + public void setPrintOnlyBusinessName(Boolean printOnlyBusinessName) { + this.printOnlyBusinessName = printOnlyBusinessName; + } + + + public CreateBusinessDebitCardAttributes expiryDate(String expiryDate) { + + this.expiryDate = expiryDate; + return this; + } + + /** + * Get expiryDate + * @return expiryDate + **/ + @javax.annotation.Nullable + public String getExpiryDate() { + return expiryDate; + } + + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessDebitCardAttributes createBusinessDebitCardAttributes = (CreateBusinessDebitCardAttributes) o; + return Objects.equals(this.shippingAddress, createBusinessDebitCardAttributes.shippingAddress) && + Objects.equals(this.address, createBusinessDebitCardAttributes.address) && + Objects.equals(this.fullName, createBusinessDebitCardAttributes.fullName) && + Objects.equals(this.phone, createBusinessDebitCardAttributes.phone) && + Objects.equals(this.email, createBusinessDebitCardAttributes.email) && + Objects.equals(this.dateOfBirth, createBusinessDebitCardAttributes.dateOfBirth) && + Objects.equals(this.nationality, createBusinessDebitCardAttributes.nationality) && + Objects.equals(this.ssn, createBusinessDebitCardAttributes.ssn) && + Objects.equals(this.passport, createBusinessDebitCardAttributes.passport) && + Objects.equals(this.design, createBusinessDebitCardAttributes.design) && + Objects.equals(this.additionalEmbossedText, createBusinessDebitCardAttributes.additionalEmbossedText) && + Objects.equals(this.tags, createBusinessDebitCardAttributes.tags) && + Objects.equals(this.limits, createBusinessDebitCardAttributes.limits) && + Objects.equals(this.idempotencyKey, createBusinessDebitCardAttributes.idempotencyKey) && + Objects.equals(this.activeForOnlineUse, createBusinessDebitCardAttributes.activeForOnlineUse) && + Objects.equals(this.printOnlyBusinessName, createBusinessDebitCardAttributes.printOnlyBusinessName) && + Objects.equals(this.expiryDate, createBusinessDebitCardAttributes.expiryDate); + } + + @Override + public int hashCode() { + return Objects.hash(shippingAddress, address, fullName, phone, email, dateOfBirth, nationality, ssn, passport, design, additionalEmbossedText, tags, limits, idempotencyKey, activeForOnlineUse, printOnlyBusinessName, expiryDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessDebitCardAttributes {\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" design: ").append(toIndentedString(design)).append("\n"); + sb.append(" additionalEmbossedText: ").append(toIndentedString(additionalEmbossedText)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" activeForOnlineUse: ").append(toIndentedString(activeForOnlineUse)).append("\n"); + sb.append(" printOnlyBusinessName: ").append(toIndentedString(printOnlyBusinessName)).append("\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingAddress"); + openapiFields.add("address"); + openapiFields.add("fullName"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("dateOfBirth"); + openapiFields.add("nationality"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("design"); + openapiFields.add("additionalEmbossedText"); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("idempotencyKey"); + openapiFields.add("activeForOnlineUse"); + openapiFields.add("printOnlyBusinessName"); + openapiFields.add("expiryDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessDebitCardAttributes is not found in the empty JSON string", CreateBusinessDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessDebitCardAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `shippingAddress` + if (jsonObj.get("shippingAddress") != null && !jsonObj.get("shippingAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("shippingAddress")); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("design") != null && !jsonObj.get("design").isJsonNull()) && !jsonObj.get("design").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `design` to be a primitive type in the JSON string but got `%s`", jsonObj.get("design").toString())); + } + if ((jsonObj.get("additionalEmbossedText") != null && !jsonObj.get("additionalEmbossedText").isJsonNull()) && !jsonObj.get("additionalEmbossedText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalEmbossedText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalEmbossedText").toString())); + } + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if ((jsonObj.get("expiryDate") != null && !jsonObj.get("expiryDate").isJsonNull()) && !jsonObj.get("expiryDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiryDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiryDate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to CreateBusinessDebitCardAttributes + */ + public static CreateBusinessDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessDebitCardAttributes.class); + } + + /** + * Convert an instance of CreateBusinessDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessVirtualCreditCard.java b/src/main/java/org/openapitools/client/model/CreateBusinessVirtualCreditCard.java new file mode 100644 index 00000000..b9b86210 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessVirtualCreditCard.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessVirtualDebitCardAttributes; +import org.openapitools.client.model.CreateCardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessVirtualCreditCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessVirtualCreditCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSVIRTUALCREDITCARD("businessVirtualCreditCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.BUSINESSVIRTUALCREDITCARD; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBusinessVirtualDebitCardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCardRelationships relationships; + + public CreateBusinessVirtualCreditCard() { + } + + public CreateBusinessVirtualCreditCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateBusinessVirtualCreditCard attributes(CreateBusinessVirtualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBusinessVirtualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBusinessVirtualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBusinessVirtualCreditCard relationships(CreateCardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessVirtualCreditCard createBusinessVirtualCreditCard = (CreateBusinessVirtualCreditCard) o; + return Objects.equals(this.type, createBusinessVirtualCreditCard.type) && + Objects.equals(this.attributes, createBusinessVirtualCreditCard.attributes) && + Objects.equals(this.relationships, createBusinessVirtualCreditCard.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessVirtualCreditCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessVirtualCreditCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessVirtualCreditCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessVirtualCreditCard is not found in the empty JSON string", CreateBusinessVirtualCreditCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessVirtualCreditCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessVirtualCreditCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessVirtualCreditCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBusinessVirtualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessVirtualCreditCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessVirtualCreditCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessVirtualCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessVirtualCreditCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessVirtualCreditCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessVirtualCreditCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessVirtualCreditCard + * @throws IOException if the JSON string is invalid with respect to CreateBusinessVirtualCreditCard + */ + public static CreateBusinessVirtualCreditCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessVirtualCreditCard.class); + } + + /** + * Convert an instance of CreateBusinessVirtualCreditCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessVirtualDebitCard.java b/src/main/java/org/openapitools/client/model/CreateBusinessVirtualDebitCard.java new file mode 100644 index 00000000..f215c0bb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessVirtualDebitCard.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessVirtualDebitCardAttributes; +import org.openapitools.client.model.CreateCardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessVirtualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessVirtualDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSVIRTUALDEBITCARD("businessVirtualDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.BUSINESSVIRTUALDEBITCARD; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateBusinessVirtualDebitCardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCardRelationships relationships; + + public CreateBusinessVirtualDebitCard() { + } + + public CreateBusinessVirtualDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateBusinessVirtualDebitCard attributes(CreateBusinessVirtualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateBusinessVirtualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateBusinessVirtualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateBusinessVirtualDebitCard relationships(CreateCardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessVirtualDebitCard createBusinessVirtualDebitCard = (CreateBusinessVirtualDebitCard) o; + return Objects.equals(this.type, createBusinessVirtualDebitCard.type) && + Objects.equals(this.attributes, createBusinessVirtualDebitCard.attributes) && + Objects.equals(this.relationships, createBusinessVirtualDebitCard.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessVirtualDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessVirtualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessVirtualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessVirtualDebitCard is not found in the empty JSON string", CreateBusinessVirtualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessVirtualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessVirtualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessVirtualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateBusinessVirtualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessVirtualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessVirtualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessVirtualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessVirtualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessVirtualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessVirtualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessVirtualDebitCard + * @throws IOException if the JSON string is invalid with respect to CreateBusinessVirtualDebitCard + */ + public static CreateBusinessVirtualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessVirtualDebitCard.class); + } + + /** + * Convert an instance of CreateBusinessVirtualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateBusinessVirtualDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/CreateBusinessVirtualDebitCardAttributes.java new file mode 100644 index 00000000..02c636de --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateBusinessVirtualDebitCardAttributes.java @@ -0,0 +1,558 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.CardLevelLimits; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateBusinessVirtualDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBusinessVirtualDebitCardAttributes { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_EXPIRY_DATE = "expiryDate"; + @SerializedName(SERIALIZED_NAME_EXPIRY_DATE) + private String expiryDate; + + public CreateBusinessVirtualDebitCardAttributes() { + } + + public CreateBusinessVirtualDebitCardAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateBusinessVirtualDebitCardAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateBusinessVirtualDebitCardAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateBusinessVirtualDebitCardAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateBusinessVirtualDebitCardAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateBusinessVirtualDebitCardAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreateBusinessVirtualDebitCardAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreateBusinessVirtualDebitCardAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreateBusinessVirtualDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateBusinessVirtualDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public CreateBusinessVirtualDebitCardAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateBusinessVirtualDebitCardAttributes expiryDate(String expiryDate) { + + this.expiryDate = expiryDate; + return this; + } + + /** + * Get expiryDate + * @return expiryDate + **/ + @javax.annotation.Nullable + public String getExpiryDate() { + return expiryDate; + } + + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBusinessVirtualDebitCardAttributes createBusinessVirtualDebitCardAttributes = (CreateBusinessVirtualDebitCardAttributes) o; + return Objects.equals(this.address, createBusinessVirtualDebitCardAttributes.address) && + Objects.equals(this.fullName, createBusinessVirtualDebitCardAttributes.fullName) && + Objects.equals(this.phone, createBusinessVirtualDebitCardAttributes.phone) && + Objects.equals(this.email, createBusinessVirtualDebitCardAttributes.email) && + Objects.equals(this.dateOfBirth, createBusinessVirtualDebitCardAttributes.dateOfBirth) && + Objects.equals(this.nationality, createBusinessVirtualDebitCardAttributes.nationality) && + Objects.equals(this.ssn, createBusinessVirtualDebitCardAttributes.ssn) && + Objects.equals(this.passport, createBusinessVirtualDebitCardAttributes.passport) && + Objects.equals(this.tags, createBusinessVirtualDebitCardAttributes.tags) && + Objects.equals(this.limits, createBusinessVirtualDebitCardAttributes.limits) && + Objects.equals(this.idempotencyKey, createBusinessVirtualDebitCardAttributes.idempotencyKey) && + Objects.equals(this.expiryDate, createBusinessVirtualDebitCardAttributes.expiryDate); + } + + @Override + public int hashCode() { + return Objects.hash(address, fullName, phone, email, dateOfBirth, nationality, ssn, passport, tags, limits, idempotencyKey, expiryDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBusinessVirtualDebitCardAttributes {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("fullName"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("dateOfBirth"); + openapiFields.add("nationality"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("idempotencyKey"); + openapiFields.add("expiryDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateBusinessVirtualDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBusinessVirtualDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateBusinessVirtualDebitCardAttributes is not found in the empty JSON string", CreateBusinessVirtualDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBusinessVirtualDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateBusinessVirtualDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBusinessVirtualDebitCardAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if ((jsonObj.get("expiryDate") != null && !jsonObj.get("expiryDate").isJsonNull()) && !jsonObj.get("expiryDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiryDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiryDate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBusinessVirtualDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBusinessVirtualDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessVirtualDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBusinessVirtualDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBusinessVirtualDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBusinessVirtualDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBusinessVirtualDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to CreateBusinessVirtualDebitCardAttributes + */ + public static CreateBusinessVirtualDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBusinessVirtualDebitCardAttributes.class); + } + + /** + * Convert an instance of CreateBusinessVirtualDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCard.java b/src/main/java/org/openapitools/client/model/CreateCard.java new file mode 100644 index 00000000..dc0157f8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCard.java @@ -0,0 +1,476 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateBusinessCreditCard; +import org.openapitools.client.model.CreateBusinessDebitCard; +import org.openapitools.client.model.CreateBusinessVirtualCreditCard; +import org.openapitools.client.model.CreateBusinessVirtualDebitCard; +import org.openapitools.client.model.CreateBusinessVirtualDebitCardAttributes; +import org.openapitools.client.model.CreateCardRelationships; +import org.openapitools.client.model.CreateIndividualDebitCard; +import org.openapitools.client.model.CreateIndividualVirtualDebitCard; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCard extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateCard.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateIndividualDebitCard = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualDebitCard.class)); + final TypeAdapter adapterCreateBusinessDebitCard = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessDebitCard.class)); + final TypeAdapter adapterCreateBusinessCreditCard = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessCreditCard.class)); + final TypeAdapter adapterCreateIndividualVirtualDebitCard = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualVirtualDebitCard.class)); + final TypeAdapter adapterCreateBusinessVirtualDebitCard = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessVirtualDebitCard.class)); + final TypeAdapter adapterCreateBusinessVirtualCreditCard = gson.getDelegateAdapter(this, TypeToken.get(CreateBusinessVirtualCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCard value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateIndividualDebitCard` + if (value.getActualInstance() instanceof CreateIndividualDebitCard) { + JsonElement element = adapterCreateIndividualDebitCard.toJsonTree((CreateIndividualDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBusinessDebitCard` + if (value.getActualInstance() instanceof CreateBusinessDebitCard) { + JsonElement element = adapterCreateBusinessDebitCard.toJsonTree((CreateBusinessDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBusinessCreditCard` + if (value.getActualInstance() instanceof CreateBusinessCreditCard) { + JsonElement element = adapterCreateBusinessCreditCard.toJsonTree((CreateBusinessCreditCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateIndividualVirtualDebitCard` + if (value.getActualInstance() instanceof CreateIndividualVirtualDebitCard) { + JsonElement element = adapterCreateIndividualVirtualDebitCard.toJsonTree((CreateIndividualVirtualDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBusinessVirtualDebitCard` + if (value.getActualInstance() instanceof CreateBusinessVirtualDebitCard) { + JsonElement element = adapterCreateBusinessVirtualDebitCard.toJsonTree((CreateBusinessVirtualDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBusinessVirtualCreditCard` + if (value.getActualInstance() instanceof CreateBusinessVirtualCreditCard) { + JsonElement element = adapterCreateBusinessVirtualCreditCard.toJsonTree((CreateBusinessVirtualCreditCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateBusinessCreditCard, CreateBusinessDebitCard, CreateBusinessVirtualCreditCard, CreateBusinessVirtualDebitCard, CreateIndividualDebitCard, CreateIndividualVirtualDebitCard"); + } + + @Override + public CreateCard read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateIndividualDebitCard + try { + // validate the JSON object to see if any exception is thrown + CreateIndividualDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterCreateIndividualDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateIndividualDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateIndividualDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateIndividualDebitCard'", e); + } + // deserialize CreateBusinessDebitCard + try { + // validate the JSON object to see if any exception is thrown + CreateBusinessDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBusinessDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBusinessDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBusinessDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBusinessDebitCard'", e); + } + // deserialize CreateBusinessCreditCard + try { + // validate the JSON object to see if any exception is thrown + CreateBusinessCreditCard.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBusinessCreditCard; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBusinessCreditCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBusinessCreditCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBusinessCreditCard'", e); + } + // deserialize CreateIndividualVirtualDebitCard + try { + // validate the JSON object to see if any exception is thrown + CreateIndividualVirtualDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterCreateIndividualVirtualDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateIndividualVirtualDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateIndividualVirtualDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateIndividualVirtualDebitCard'", e); + } + // deserialize CreateBusinessVirtualDebitCard + try { + // validate the JSON object to see if any exception is thrown + CreateBusinessVirtualDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBusinessVirtualDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBusinessVirtualDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBusinessVirtualDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBusinessVirtualDebitCard'", e); + } + // deserialize CreateBusinessVirtualCreditCard + try { + // validate the JSON object to see if any exception is thrown + CreateBusinessVirtualCreditCard.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBusinessVirtualCreditCard; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBusinessVirtualCreditCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBusinessVirtualCreditCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBusinessVirtualCreditCard'", e); + } + + if (match == 1) { + CreateCard ret = new CreateCard(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateCard: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateCard() { + super("oneOf", Boolean.FALSE); + } + + public CreateCard(CreateBusinessCreditCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateCard(CreateBusinessDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateCard(CreateBusinessVirtualCreditCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateCard(CreateBusinessVirtualDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateCard(CreateIndividualDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateCard(CreateIndividualVirtualDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateIndividualDebitCard", CreateIndividualDebitCard.class); + schemas.put("CreateBusinessDebitCard", CreateBusinessDebitCard.class); + schemas.put("CreateBusinessCreditCard", CreateBusinessCreditCard.class); + schemas.put("CreateIndividualVirtualDebitCard", CreateIndividualVirtualDebitCard.class); + schemas.put("CreateBusinessVirtualDebitCard", CreateBusinessVirtualDebitCard.class); + schemas.put("CreateBusinessVirtualCreditCard", CreateBusinessVirtualCreditCard.class); + } + + @Override + public Map> getSchemas() { + return CreateCard.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateBusinessCreditCard, CreateBusinessDebitCard, CreateBusinessVirtualCreditCard, CreateBusinessVirtualDebitCard, CreateIndividualDebitCard, CreateIndividualVirtualDebitCard + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateIndividualDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBusinessDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBusinessCreditCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateIndividualVirtualDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBusinessVirtualDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBusinessVirtualCreditCard) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateBusinessCreditCard, CreateBusinessDebitCard, CreateBusinessVirtualCreditCard, CreateBusinessVirtualDebitCard, CreateIndividualDebitCard, CreateIndividualVirtualDebitCard"); + } + + /** + * Get the actual instance, which can be the following: + * CreateBusinessCreditCard, CreateBusinessDebitCard, CreateBusinessVirtualCreditCard, CreateBusinessVirtualDebitCard, CreateIndividualDebitCard, CreateIndividualVirtualDebitCard + * + * @return The actual instance (CreateBusinessCreditCard, CreateBusinessDebitCard, CreateBusinessVirtualCreditCard, CreateBusinessVirtualDebitCard, CreateIndividualDebitCard, CreateIndividualVirtualDebitCard) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateIndividualDebitCard`. If the actual instance is not `CreateIndividualDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateIndividualDebitCard` + * @throws ClassCastException if the instance is not `CreateIndividualDebitCard` + */ + public CreateIndividualDebitCard getCreateIndividualDebitCard() throws ClassCastException { + return (CreateIndividualDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBusinessDebitCard`. If the actual instance is not `CreateBusinessDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBusinessDebitCard` + * @throws ClassCastException if the instance is not `CreateBusinessDebitCard` + */ + public CreateBusinessDebitCard getCreateBusinessDebitCard() throws ClassCastException { + return (CreateBusinessDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBusinessCreditCard`. If the actual instance is not `CreateBusinessCreditCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBusinessCreditCard` + * @throws ClassCastException if the instance is not `CreateBusinessCreditCard` + */ + public CreateBusinessCreditCard getCreateBusinessCreditCard() throws ClassCastException { + return (CreateBusinessCreditCard)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateIndividualVirtualDebitCard`. If the actual instance is not `CreateIndividualVirtualDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateIndividualVirtualDebitCard` + * @throws ClassCastException if the instance is not `CreateIndividualVirtualDebitCard` + */ + public CreateIndividualVirtualDebitCard getCreateIndividualVirtualDebitCard() throws ClassCastException { + return (CreateIndividualVirtualDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBusinessVirtualDebitCard`. If the actual instance is not `CreateBusinessVirtualDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBusinessVirtualDebitCard` + * @throws ClassCastException if the instance is not `CreateBusinessVirtualDebitCard` + */ + public CreateBusinessVirtualDebitCard getCreateBusinessVirtualDebitCard() throws ClassCastException { + return (CreateBusinessVirtualDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBusinessVirtualCreditCard`. If the actual instance is not `CreateBusinessVirtualCreditCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBusinessVirtualCreditCard` + * @throws ClassCastException if the instance is not `CreateBusinessVirtualCreditCard` + */ + public CreateBusinessVirtualCreditCard getCreateBusinessVirtualCreditCard() throws ClassCastException { + return (CreateBusinessVirtualCreditCard)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateIndividualDebitCard + try { + CreateIndividualDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateIndividualDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBusinessDebitCard + try { + CreateBusinessDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBusinessDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBusinessCreditCard + try { + CreateBusinessCreditCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBusinessCreditCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateIndividualVirtualDebitCard + try { + CreateIndividualVirtualDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateIndividualVirtualDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBusinessVirtualDebitCard + try { + CreateBusinessVirtualDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBusinessVirtualDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBusinessVirtualCreditCard + try { + CreateBusinessVirtualCreditCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBusinessVirtualCreditCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateCard with oneOf schemas: CreateBusinessCreditCard, CreateBusinessDebitCard, CreateBusinessVirtualCreditCard, CreateBusinessVirtualDebitCard, CreateIndividualDebitCard, CreateIndividualVirtualDebitCard. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCard + * @throws IOException if the JSON string is invalid with respect to CreateCard + */ + public static CreateCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCard.class); + } + + /** + * Convert an instance of CreateCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCardRelationships.java b/src/main/java/org/openapitools/client/model/CreateCardRelationships.java new file mode 100644 index 00000000..14c6b64b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCardRelationships.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCardRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCardRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public static final String SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT = "defaultFundingAccount"; + @SerializedName(SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT) + private Relationship defaultFundingAccount; + + public CreateCardRelationships() { + } + + public CreateCardRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + public CreateCardRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + public CreateCardRelationships defaultFundingAccount(Relationship defaultFundingAccount) { + + this.defaultFundingAccount = defaultFundingAccount; + return this; + } + + /** + * Get defaultFundingAccount + * @return defaultFundingAccount + **/ + @javax.annotation.Nullable + public Relationship getDefaultFundingAccount() { + return defaultFundingAccount; + } + + + public void setDefaultFundingAccount(Relationship defaultFundingAccount) { + this.defaultFundingAccount = defaultFundingAccount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCardRelationships createCardRelationships = (CreateCardRelationships) o; + return Objects.equals(this.account, createCardRelationships.account) && + Objects.equals(this.customer, createCardRelationships.customer) && + Objects.equals(this.defaultFundingAccount, createCardRelationships.defaultFundingAccount); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer, defaultFundingAccount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCardRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" defaultFundingAccount: ").append(toIndentedString(defaultFundingAccount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("defaultFundingAccount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCardRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCardRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCardRelationships is not found in the empty JSON string", CreateCardRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCardRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCardRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCardRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `defaultFundingAccount` + if (jsonObj.get("defaultFundingAccount") != null && !jsonObj.get("defaultFundingAccount").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("defaultFundingAccount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCardRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCardRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCardRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCardRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCardRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCardRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCardRelationships + * @throws IOException if the JSON string is invalid with respect to CreateCardRelationships + */ + public static CreateCardRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCardRelationships.class); + } + + /** + * Convert an instance of CreateCardRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCheckDeposit.java b/src/main/java/org/openapitools/client/model/CreateCheckDeposit.java new file mode 100644 index 00000000..b5a06d99 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCheckDeposit.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCheckDepositAttributes; +import org.openapitools.client.model.CreateCheckDepositRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCheckDeposit + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCheckDeposit { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CHECKDEPOSIT("checkDeposit"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateCheckDepositAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCheckDepositRelationships relationships; + + public CreateCheckDeposit() { + } + + public CreateCheckDeposit type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateCheckDeposit attributes(CreateCheckDepositAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateCheckDepositAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateCheckDepositAttributes attributes) { + this.attributes = attributes; + } + + + public CreateCheckDeposit relationships(CreateCheckDepositRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCheckDepositRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCheckDepositRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCheckDeposit createCheckDeposit = (CreateCheckDeposit) o; + return Objects.equals(this.type, createCheckDeposit.type) && + Objects.equals(this.attributes, createCheckDeposit.attributes) && + Objects.equals(this.relationships, createCheckDeposit.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCheckDeposit {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCheckDeposit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCheckDeposit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCheckDeposit is not found in the empty JSON string", CreateCheckDeposit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCheckDeposit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCheckDeposit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCheckDeposit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateCheckDepositAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCheckDepositRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCheckDeposit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCheckDeposit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCheckDeposit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCheckDeposit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCheckDeposit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCheckDeposit given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCheckDeposit + * @throws IOException if the JSON string is invalid with respect to CreateCheckDeposit + */ + public static CreateCheckDeposit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCheckDeposit.class); + } + + /** + * Convert an instance of CreateCheckDeposit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCheckDepositAttributes.java b/src/main/java/org/openapitools/client/model/CreateCheckDepositAttributes.java new file mode 100644 index 00000000..dfe39be2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCheckDepositAttributes.java @@ -0,0 +1,305 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCheckDepositAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCheckDepositAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CreateCheckDepositAttributes() { + } + + public CreateCheckDepositAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateCheckDepositAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateCheckDepositAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateCheckDepositAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCheckDepositAttributes createCheckDepositAttributes = (CreateCheckDepositAttributes) o; + return Objects.equals(this.amount, createCheckDepositAttributes.amount) && + Objects.equals(this.description, createCheckDepositAttributes.description) && + Objects.equals(this.idempotencyKey, createCheckDepositAttributes.idempotencyKey) && + Objects.equals(this.tags, createCheckDepositAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, idempotencyKey, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCheckDepositAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCheckDepositAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCheckDepositAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCheckDepositAttributes is not found in the empty JSON string", CreateCheckDepositAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCheckDepositAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCheckDepositAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCheckDepositAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCheckDepositAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCheckDepositAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCheckDepositAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCheckDepositAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCheckDepositAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCheckDepositAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCheckDepositAttributes + * @throws IOException if the JSON string is invalid with respect to CreateCheckDepositAttributes + */ + public static CreateCheckDepositAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCheckDepositAttributes.class); + } + + /** + * Convert an instance of CreateCheckDepositAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCheckDepositRelationships.java b/src/main/java/org/openapitools/client/model/CreateCheckDepositRelationships.java new file mode 100644 index 00000000..ce1c36b5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCheckDepositRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCheckDepositRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCheckDepositRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public CreateCheckDepositRelationships() { + } + + public CreateCheckDepositRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCheckDepositRelationships createCheckDepositRelationships = (CreateCheckDepositRelationships) o; + return Objects.equals(this.account, createCheckDepositRelationships.account); + } + + @Override + public int hashCode() { + return Objects.hash(account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCheckDepositRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCheckDepositRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCheckDepositRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCheckDepositRelationships is not found in the empty JSON string", CreateCheckDepositRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCheckDepositRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCheckDepositRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCheckDepositRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCheckDepositRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCheckDepositRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCheckDepositRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCheckDepositRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCheckDepositRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCheckDepositRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCheckDepositRelationships + * @throws IOException if the JSON string is invalid with respect to CreateCheckDepositRelationships + */ + public static CreateCheckDepositRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCheckDepositRelationships.class); + } + + /** + * Convert an instance of CreateCheckDepositRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCheckPayment.java b/src/main/java/org/openapitools/client/model/CreateCheckPayment.java new file mode 100644 index 00000000..92ea1164 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCheckPayment.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCheckPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCheckPayment { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CheckPayment data; + + public CreateCheckPayment() { + } + + public CreateCheckPayment data(CheckPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CheckPayment getData() { + return data; + } + + + public void setData(CheckPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCheckPayment createCheckPayment = (CreateCheckPayment) o; + return Objects.equals(this.data, createCheckPayment.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCheckPayment {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCheckPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCheckPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCheckPayment is not found in the empty JSON string", CreateCheckPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCheckPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCheckPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCheckPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CheckPayment.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCheckPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCheckPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCheckPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCheckPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCheckPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCheckPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCheckPayment + * @throws IOException if the JSON string is invalid with respect to CreateCheckPayment + */ + public static CreateCheckPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCheckPayment.class); + } + + /** + * Convert an instance of CreateCheckPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCounterparty.java b/src/main/java/org/openapitools/client/model/CreateCounterparty.java new file mode 100644 index 00000000..a729a8b7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCounterparty.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchCounterparty; +import org.openapitools.client.model.CreateCounterpartyRelationships; +import org.openapitools.client.model.CreatePlaidCounterparty; +import org.openapitools.client.model.CreatePlaidCounterpartyAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCounterparty extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateCounterparty.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateAchCounterparty = gson.getDelegateAdapter(this, TypeToken.get(CreateAchCounterparty.class)); + final TypeAdapter adapterCreatePlaidCounterparty = gson.getDelegateAdapter(this, TypeToken.get(CreatePlaidCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCounterparty value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateAchCounterparty` + if (value.getActualInstance() instanceof CreateAchCounterparty) { + JsonElement element = adapterCreateAchCounterparty.toJsonTree((CreateAchCounterparty)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreatePlaidCounterparty` + if (value.getActualInstance() instanceof CreatePlaidCounterparty) { + JsonElement element = adapterCreatePlaidCounterparty.toJsonTree((CreatePlaidCounterparty)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateAchCounterparty, CreatePlaidCounterparty"); + } + + @Override + public CreateCounterparty read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateAchCounterparty + try { + // validate the JSON object to see if any exception is thrown + CreateAchCounterparty.validateJsonElement(jsonElement); + actualAdapter = adapterCreateAchCounterparty; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateAchCounterparty'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateAchCounterparty failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateAchCounterparty'", e); + } + // deserialize CreatePlaidCounterparty + try { + // validate the JSON object to see if any exception is thrown + CreatePlaidCounterparty.validateJsonElement(jsonElement); + actualAdapter = adapterCreatePlaidCounterparty; + match++; + log.log(Level.FINER, "Input data matches schema 'CreatePlaidCounterparty'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreatePlaidCounterparty failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreatePlaidCounterparty'", e); + } + + if (match == 1) { + CreateCounterparty ret = new CreateCounterparty(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateCounterparty: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateCounterparty() { + super("oneOf", Boolean.FALSE); + } + + public CreateCounterparty(CreateAchCounterparty o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateCounterparty(CreatePlaidCounterparty o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateAchCounterparty", CreateAchCounterparty.class); + schemas.put("CreatePlaidCounterparty", CreatePlaidCounterparty.class); + } + + @Override + public Map> getSchemas() { + return CreateCounterparty.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateAchCounterparty, CreatePlaidCounterparty + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateAchCounterparty) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreatePlaidCounterparty) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateAchCounterparty, CreatePlaidCounterparty"); + } + + /** + * Get the actual instance, which can be the following: + * CreateAchCounterparty, CreatePlaidCounterparty + * + * @return The actual instance (CreateAchCounterparty, CreatePlaidCounterparty) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateAchCounterparty`. If the actual instance is not `CreateAchCounterparty`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateAchCounterparty` + * @throws ClassCastException if the instance is not `CreateAchCounterparty` + */ + public CreateAchCounterparty getCreateAchCounterparty() throws ClassCastException { + return (CreateAchCounterparty)super.getActualInstance(); + } + /** + * Get the actual instance of `CreatePlaidCounterparty`. If the actual instance is not `CreatePlaidCounterparty`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreatePlaidCounterparty` + * @throws ClassCastException if the instance is not `CreatePlaidCounterparty` + */ + public CreatePlaidCounterparty getCreatePlaidCounterparty() throws ClassCastException { + return (CreatePlaidCounterparty)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateAchCounterparty + try { + CreateAchCounterparty.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateAchCounterparty failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreatePlaidCounterparty + try { + CreatePlaidCounterparty.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreatePlaidCounterparty failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateCounterparty with oneOf schemas: CreateAchCounterparty, CreatePlaidCounterparty. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCounterparty + * @throws IOException if the JSON string is invalid with respect to CreateCounterparty + */ + public static CreateCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCounterparty.class); + } + + /** + * Convert an instance of CreateCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCounterpartyRelationships.java b/src/main/java/org/openapitools/client/model/CreateCounterpartyRelationships.java new file mode 100644 index 00000000..ca59e554 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCounterpartyRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCounterpartyRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCounterpartyRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public CreateCounterpartyRelationships() { + } + + public CreateCounterpartyRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCounterpartyRelationships createCounterpartyRelationships = (CreateCounterpartyRelationships) o; + return Objects.equals(this.customer, createCounterpartyRelationships.customer); + } + + @Override + public int hashCode() { + return Objects.hash(customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCounterpartyRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCounterpartyRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCounterpartyRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCounterpartyRelationships is not found in the empty JSON string", CreateCounterpartyRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCounterpartyRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCounterpartyRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCounterpartyRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `customer` + Relationship.validateJsonElement(jsonObj.get("customer")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCounterpartyRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCounterpartyRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCounterpartyRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCounterpartyRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCounterpartyRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCounterpartyRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCounterpartyRelationships + * @throws IOException if the JSON string is invalid with respect to CreateCounterpartyRelationships + */ + public static CreateCounterpartyRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCounterpartyRelationships.class); + } + + /** + * Convert an instance of CreateCounterpartyRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCreditAccount.java b/src/main/java/org/openapitools/client/model/CreateCreditAccount.java new file mode 100644 index 00000000..28fffaf4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCreditAccount.java @@ -0,0 +1,319 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCreditAccountAttributes; +import org.openapitools.client.model.CreateCreditAccountRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCreditAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCreditAccount { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CREDITACCOUNT("creditAccount"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.CREDITACCOUNT; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateCreditAccountAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCreditAccountRelationships relationships; + + public CreateCreditAccount() { + } + + public CreateCreditAccount type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateCreditAccount attributes(CreateCreditAccountAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CreateCreditAccountAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateCreditAccountAttributes attributes) { + this.attributes = attributes; + } + + + public CreateCreditAccount relationships(CreateCreditAccountRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CreateCreditAccountRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCreditAccountRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCreditAccount createCreditAccount = (CreateCreditAccount) o; + return Objects.equals(this.type, createCreditAccount.type) && + Objects.equals(this.attributes, createCreditAccount.attributes) && + Objects.equals(this.relationships, createCreditAccount.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCreditAccount {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCreditAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCreditAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCreditAccount is not found in the empty JSON string", CreateCreditAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCreditAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCreditAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CreateCreditAccountAttributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreateCreditAccountRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCreditAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCreditAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCreditAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCreditAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCreditAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCreditAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCreditAccount + * @throws IOException if the JSON string is invalid with respect to CreateCreditAccount + */ + public static CreateCreditAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCreditAccount.class); + } + + /** + * Convert an instance of CreateCreditAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCreditAccountAttributes.java b/src/main/java/org/openapitools/client/model/CreateCreditAccountAttributes.java new file mode 100644 index 00000000..05ffc1f3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCreditAccountAttributes.java @@ -0,0 +1,316 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCreditAccountAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCreditAccountAttributes { + public static final String SERIALIZED_NAME_CREDIT_TERMS = "creditTerms"; + @SerializedName(SERIALIZED_NAME_CREDIT_TERMS) + private String creditTerms; + + public static final String SERIALIZED_NAME_CREDIT_LIMIT = "creditLimit"; + @SerializedName(SERIALIZED_NAME_CREDIT_LIMIT) + private Integer creditLimit; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public CreateCreditAccountAttributes() { + } + + public CreateCreditAccountAttributes creditTerms(String creditTerms) { + + this.creditTerms = creditTerms; + return this; + } + + /** + * Get creditTerms + * @return creditTerms + **/ + @javax.annotation.Nonnull + public String getCreditTerms() { + return creditTerms; + } + + + public void setCreditTerms(String creditTerms) { + this.creditTerms = creditTerms; + } + + + public CreateCreditAccountAttributes creditLimit(Integer creditLimit) { + + this.creditLimit = creditLimit; + return this; + } + + /** + * Get creditLimit + * @return creditLimit + **/ + @javax.annotation.Nonnull + public Integer getCreditLimit() { + return creditLimit; + } + + + public void setCreditLimit(Integer creditLimit) { + this.creditLimit = creditLimit; + } + + + public CreateCreditAccountAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateCreditAccountAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCreditAccountAttributes createCreditAccountAttributes = (CreateCreditAccountAttributes) o; + return Objects.equals(this.creditTerms, createCreditAccountAttributes.creditTerms) && + Objects.equals(this.creditLimit, createCreditAccountAttributes.creditLimit) && + Objects.equals(this.tags, createCreditAccountAttributes.tags) && + Objects.equals(this.idempotencyKey, createCreditAccountAttributes.idempotencyKey); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(creditTerms, creditLimit, tags, idempotencyKey); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCreditAccountAttributes {\n"); + sb.append(" creditTerms: ").append(toIndentedString(creditTerms)).append("\n"); + sb.append(" creditLimit: ").append(toIndentedString(creditLimit)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("creditTerms"); + openapiFields.add("creditLimit"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("creditTerms"); + openapiRequiredFields.add("creditLimit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCreditAccountAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCreditAccountAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCreditAccountAttributes is not found in the empty JSON string", CreateCreditAccountAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCreditAccountAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCreditAccountAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCreditAccountAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("creditTerms").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creditTerms` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditTerms").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCreditAccountAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCreditAccountAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCreditAccountAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCreditAccountAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCreditAccountAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCreditAccountAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCreditAccountAttributes + * @throws IOException if the JSON string is invalid with respect to CreateCreditAccountAttributes + */ + public static CreateCreditAccountAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCreditAccountAttributes.class); + } + + /** + * Convert an instance of CreateCreditAccountAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCreditAccountRelationships.java b/src/main/java/org/openapitools/client/model/CreateCreditAccountRelationships.java new file mode 100644 index 00000000..a3a051fa --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCreditAccountRelationships.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerLinkage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCreditAccountRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCreditAccountRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private CustomerLinkage customer; + + public CreateCreditAccountRelationships() { + } + + public CreateCreditAccountRelationships customer(CustomerLinkage customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public CustomerLinkage getCustomer() { + return customer; + } + + + public void setCustomer(CustomerLinkage customer) { + this.customer = customer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCreditAccountRelationships createCreditAccountRelationships = (CreateCreditAccountRelationships) o; + return Objects.equals(this.customer, createCreditAccountRelationships.customer); + } + + @Override + public int hashCode() { + return Objects.hash(customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCreditAccountRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCreditAccountRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCreditAccountRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCreditAccountRelationships is not found in the empty JSON string", CreateCreditAccountRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCreditAccountRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCreditAccountRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + CustomerLinkage.validateJsonElement(jsonObj.get("customer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCreditAccountRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCreditAccountRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCreditAccountRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCreditAccountRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCreditAccountRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCreditAccountRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCreditAccountRelationships + * @throws IOException if the JSON string is invalid with respect to CreateCreditAccountRelationships + */ + public static CreateCreditAccountRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCreditAccountRelationships.class); + } + + /** + * Convert an instance of CreateCreditAccountRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCustomerToken.java b/src/main/java/org/openapitools/client/model/CreateCustomerToken.java new file mode 100644 index 00000000..62f11bc1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCustomerToken.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCustomerTokenAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCustomerToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCustomerToken { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "customerToken"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateCustomerTokenAttributes attributes; + + public CreateCustomerToken() { + } + + public CreateCustomerToken type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateCustomerToken attributes(CreateCustomerTokenAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CreateCustomerTokenAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateCustomerTokenAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCustomerToken createCustomerToken = (CreateCustomerToken) o; + return Objects.equals(this.type, createCustomerToken.type) && + Objects.equals(this.attributes, createCustomerToken.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCustomerToken {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCustomerToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCustomerToken.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCustomerToken is not found in the empty JSON string", CreateCustomerToken.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCustomerToken.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCustomerToken` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CreateCustomerTokenAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCustomerToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCustomerToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCustomerToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCustomerToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCustomerToken read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCustomerToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCustomerToken + * @throws IOException if the JSON string is invalid with respect to CreateCustomerToken + */ + public static CreateCustomerToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCustomerToken.class); + } + + /** + * Convert an instance of CreateCustomerToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCustomerTokenAttributes.java b/src/main/java/org/openapitools/client/model/CreateCustomerTokenAttributes.java new file mode 100644 index 00000000..4e5c2ef1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCustomerTokenAttributes.java @@ -0,0 +1,413 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.CreateApiTokenAttributesResourcesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCustomerTokenAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCustomerTokenAttributes { + public static final String SERIALIZED_NAME_SCOPE = "scope"; + @SerializedName(SERIALIZED_NAME_SCOPE) + private String scope; + + public static final String SERIALIZED_NAME_VERIFICATION_TOKEN = "verificationToken"; + @SerializedName(SERIALIZED_NAME_VERIFICATION_TOKEN) + private String verificationToken; + + public static final String SERIALIZED_NAME_JWT_TOKEN = "jwtToken"; + @SerializedName(SERIALIZED_NAME_JWT_TOKEN) + private String jwtToken; + + public static final String SERIALIZED_NAME_EXPIRES_IN = "expiresIn"; + @SerializedName(SERIALIZED_NAME_EXPIRES_IN) + private Integer expiresIn; + + public static final String SERIALIZED_NAME_VERIFICATION_CODE = "verificationCode"; + @SerializedName(SERIALIZED_NAME_VERIFICATION_CODE) + private String verificationCode; + + public static final String SERIALIZED_NAME_RESOURCES = "resources"; + @SerializedName(SERIALIZED_NAME_RESOURCES) + private List resources; + + public static final String SERIALIZED_NAME_UPGRADABLE_SCOPE = "upgradableScope"; + @SerializedName(SERIALIZED_NAME_UPGRADABLE_SCOPE) + private String upgradableScope; + + public CreateCustomerTokenAttributes() { + } + + public CreateCustomerTokenAttributes scope(String scope) { + + this.scope = scope; + return this; + } + + /** + * Get scope + * @return scope + **/ + @javax.annotation.Nullable + public String getScope() { + return scope; + } + + + public void setScope(String scope) { + this.scope = scope; + } + + + public CreateCustomerTokenAttributes verificationToken(String verificationToken) { + + this.verificationToken = verificationToken; + return this; + } + + /** + * Get verificationToken + * @return verificationToken + **/ + @javax.annotation.Nullable + public String getVerificationToken() { + return verificationToken; + } + + + public void setVerificationToken(String verificationToken) { + this.verificationToken = verificationToken; + } + + + public CreateCustomerTokenAttributes jwtToken(String jwtToken) { + + this.jwtToken = jwtToken; + return this; + } + + /** + * Get jwtToken + * @return jwtToken + **/ + @javax.annotation.Nullable + public String getJwtToken() { + return jwtToken; + } + + + public void setJwtToken(String jwtToken) { + this.jwtToken = jwtToken; + } + + + public CreateCustomerTokenAttributes expiresIn(Integer expiresIn) { + + this.expiresIn = expiresIn; + return this; + } + + /** + * Get expiresIn + * @return expiresIn + **/ + @javax.annotation.Nullable + public Integer getExpiresIn() { + return expiresIn; + } + + + public void setExpiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + } + + + public CreateCustomerTokenAttributes verificationCode(String verificationCode) { + + this.verificationCode = verificationCode; + return this; + } + + /** + * Get verificationCode + * @return verificationCode + **/ + @javax.annotation.Nullable + public String getVerificationCode() { + return verificationCode; + } + + + public void setVerificationCode(String verificationCode) { + this.verificationCode = verificationCode; + } + + + public CreateCustomerTokenAttributes resources(List resources) { + + this.resources = resources; + return this; + } + + public CreateCustomerTokenAttributes addResourcesItem(CreateApiTokenAttributesResourcesInner resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * @return resources + **/ + @javax.annotation.Nullable + public List getResources() { + return resources; + } + + + public void setResources(List resources) { + this.resources = resources; + } + + + public CreateCustomerTokenAttributes upgradableScope(String upgradableScope) { + + this.upgradableScope = upgradableScope; + return this; + } + + /** + * Get upgradableScope + * @return upgradableScope + **/ + @javax.annotation.Nullable + public String getUpgradableScope() { + return upgradableScope; + } + + + public void setUpgradableScope(String upgradableScope) { + this.upgradableScope = upgradableScope; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCustomerTokenAttributes createCustomerTokenAttributes = (CreateCustomerTokenAttributes) o; + return Objects.equals(this.scope, createCustomerTokenAttributes.scope) && + Objects.equals(this.verificationToken, createCustomerTokenAttributes.verificationToken) && + Objects.equals(this.jwtToken, createCustomerTokenAttributes.jwtToken) && + Objects.equals(this.expiresIn, createCustomerTokenAttributes.expiresIn) && + Objects.equals(this.verificationCode, createCustomerTokenAttributes.verificationCode) && + Objects.equals(this.resources, createCustomerTokenAttributes.resources) && + Objects.equals(this.upgradableScope, createCustomerTokenAttributes.upgradableScope); + } + + @Override + public int hashCode() { + return Objects.hash(scope, verificationToken, jwtToken, expiresIn, verificationCode, resources, upgradableScope); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCustomerTokenAttributes {\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" verificationToken: ").append(toIndentedString(verificationToken)).append("\n"); + sb.append(" jwtToken: ").append(toIndentedString(jwtToken)).append("\n"); + sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).append("\n"); + sb.append(" verificationCode: ").append(toIndentedString(verificationCode)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" upgradableScope: ").append(toIndentedString(upgradableScope)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scope"); + openapiFields.add("verificationToken"); + openapiFields.add("jwtToken"); + openapiFields.add("expiresIn"); + openapiFields.add("verificationCode"); + openapiFields.add("resources"); + openapiFields.add("upgradableScope"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCustomerTokenAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCustomerTokenAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCustomerTokenAttributes is not found in the empty JSON string", CreateCustomerTokenAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCustomerTokenAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCustomerTokenAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); + } + if ((jsonObj.get("verificationToken") != null && !jsonObj.get("verificationToken").isJsonNull()) && !jsonObj.get("verificationToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `verificationToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verificationToken").toString())); + } + if ((jsonObj.get("jwtToken") != null && !jsonObj.get("jwtToken").isJsonNull()) && !jsonObj.get("jwtToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtToken").toString())); + } + if ((jsonObj.get("verificationCode") != null && !jsonObj.get("verificationCode").isJsonNull()) && !jsonObj.get("verificationCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `verificationCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verificationCode").toString())); + } + if (jsonObj.get("resources") != null && !jsonObj.get("resources").isJsonNull()) { + JsonArray jsonArrayresources = jsonObj.getAsJsonArray("resources"); + if (jsonArrayresources != null) { + // ensure the json data is an array + if (!jsonObj.get("resources").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `resources` to be an array in the JSON string but got `%s`", jsonObj.get("resources").toString())); + } + + // validate the optional field `resources` (array) + for (int i = 0; i < jsonArrayresources.size(); i++) { + CreateApiTokenAttributesResourcesInner.validateJsonElement(jsonArrayresources.get(i)); + }; + } + } + if ((jsonObj.get("upgradableScope") != null && !jsonObj.get("upgradableScope").isJsonNull()) && !jsonObj.get("upgradableScope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `upgradableScope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("upgradableScope").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCustomerTokenAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCustomerTokenAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCustomerTokenAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCustomerTokenAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCustomerTokenAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCustomerTokenAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCustomerTokenAttributes + * @throws IOException if the JSON string is invalid with respect to CreateCustomerTokenAttributes + */ + public static CreateCustomerTokenAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCustomerTokenAttributes.class); + } + + /** + * Convert an instance of CreateCustomerTokenAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCustomerTokenVerification.java b/src/main/java/org/openapitools/client/model/CreateCustomerTokenVerification.java new file mode 100644 index 00000000..f6e9bc78 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCustomerTokenVerification.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCustomerTokenVerificationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCustomerTokenVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCustomerTokenVerification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "customerTokenVerification"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateCustomerTokenVerificationAttributes attributes; + + public CreateCustomerTokenVerification() { + } + + public CreateCustomerTokenVerification type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateCustomerTokenVerification attributes(CreateCustomerTokenVerificationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateCustomerTokenVerificationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateCustomerTokenVerificationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCustomerTokenVerification createCustomerTokenVerification = (CreateCustomerTokenVerification) o; + return Objects.equals(this.type, createCustomerTokenVerification.type) && + Objects.equals(this.attributes, createCustomerTokenVerification.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCustomerTokenVerification {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCustomerTokenVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCustomerTokenVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCustomerTokenVerification is not found in the empty JSON string", CreateCustomerTokenVerification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCustomerTokenVerification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCustomerTokenVerification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCustomerTokenVerification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateCustomerTokenVerificationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCustomerTokenVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCustomerTokenVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCustomerTokenVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCustomerTokenVerification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCustomerTokenVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCustomerTokenVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCustomerTokenVerification + * @throws IOException if the JSON string is invalid with respect to CreateCustomerTokenVerification + */ + public static CreateCustomerTokenVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCustomerTokenVerification.class); + } + + /** + * Convert an instance of CreateCustomerTokenVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateCustomerTokenVerificationAttributes.java b/src/main/java/org/openapitools/client/model/CreateCustomerTokenVerificationAttributes.java new file mode 100644 index 00000000..cb38a13f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateCustomerTokenVerificationAttributes.java @@ -0,0 +1,483 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateCustomerTokenVerificationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateCustomerTokenVerificationAttributes { + /** + * Gets or Sets channel + */ + @JsonAdapter(ChannelEnum.Adapter.class) + public enum ChannelEnum { + SMS("sms"), + + CALL("call"); + + private String value; + + ChannelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ChannelEnum fromValue(String value) { + for (ChannelEnum b : ChannelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ChannelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ChannelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ChannelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CHANNEL = "channel"; + @SerializedName(SERIALIZED_NAME_CHANNEL) + private ChannelEnum channel; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_APP_HASH = "appHash"; + @SerializedName(SERIALIZED_NAME_APP_HASH) + private String appHash; + + /** + * Gets or Sets language + */ + @JsonAdapter(LanguageEnum.Adapter.class) + public enum LanguageEnum { + EN("en"), + + AF("af"), + + AR("ar"), + + CA("ca"), + + ZH("zh"), + + ZH_CN("zh-CN"), + + ZH_HK("zh-HK"), + + HR("hr"), + + CS("cs"), + + DA("da"), + + NL("nl"), + + EN_GB("en-GB"), + + ET("et"), + + FI("fi"), + + FR("fr"), + + DE("de"), + + EL("el"), + + HE("he"), + + HI("hi"), + + HU("hu"), + + ID("id"), + + IT("it"), + + JA("ja"), + + KN("kn"), + + KO("ko"), + + MS("ms"), + + MR("mr"), + + NB("nb"), + + PL("pl"), + + PT_BR("pt-BR"), + + PT("pt"), + + RO("ro"), + + RU("ru"), + + SK("sk"), + + ES("es"), + + SV("sv"), + + TL("tl"), + + TE("te"), + + TH("th"), + + TR("tr"), + + VI("vi"); + + private String value; + + LanguageEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LanguageEnum fromValue(String value) { + for (LanguageEnum b : LanguageEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LanguageEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LanguageEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LanguageEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + private LanguageEnum language; + + public CreateCustomerTokenVerificationAttributes() { + } + + public CreateCustomerTokenVerificationAttributes channel(ChannelEnum channel) { + + this.channel = channel; + return this; + } + + /** + * Get channel + * @return channel + **/ + @javax.annotation.Nonnull + public ChannelEnum getChannel() { + return channel; + } + + + public void setChannel(ChannelEnum channel) { + this.channel = channel; + } + + + public CreateCustomerTokenVerificationAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateCustomerTokenVerificationAttributes appHash(String appHash) { + + this.appHash = appHash; + return this; + } + + /** + * Get appHash + * @return appHash + **/ + @javax.annotation.Nullable + public String getAppHash() { + return appHash; + } + + + public void setAppHash(String appHash) { + this.appHash = appHash; + } + + + public CreateCustomerTokenVerificationAttributes language(LanguageEnum language) { + + this.language = language; + return this; + } + + /** + * Get language + * @return language + **/ + @javax.annotation.Nullable + public LanguageEnum getLanguage() { + return language; + } + + + public void setLanguage(LanguageEnum language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCustomerTokenVerificationAttributes createCustomerTokenVerificationAttributes = (CreateCustomerTokenVerificationAttributes) o; + return Objects.equals(this.channel, createCustomerTokenVerificationAttributes.channel) && + Objects.equals(this.phone, createCustomerTokenVerificationAttributes.phone) && + Objects.equals(this.appHash, createCustomerTokenVerificationAttributes.appHash) && + Objects.equals(this.language, createCustomerTokenVerificationAttributes.language); + } + + @Override + public int hashCode() { + return Objects.hash(channel, phone, appHash, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCustomerTokenVerificationAttributes {\n"); + sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" appHash: ").append(toIndentedString(appHash)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("channel"); + openapiFields.add("phone"); + openapiFields.add("appHash"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("channel"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCustomerTokenVerificationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCustomerTokenVerificationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCustomerTokenVerificationAttributes is not found in the empty JSON string", CreateCustomerTokenVerificationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateCustomerTokenVerificationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCustomerTokenVerificationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCustomerTokenVerificationAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("channel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `channel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("channel").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("appHash") != null && !jsonObj.get("appHash").isJsonNull()) && !jsonObj.get("appHash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `appHash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("appHash").toString())); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCustomerTokenVerificationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCustomerTokenVerificationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCustomerTokenVerificationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCustomerTokenVerificationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateCustomerTokenVerificationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCustomerTokenVerificationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCustomerTokenVerificationAttributes + * @throws IOException if the JSON string is invalid with respect to CreateCustomerTokenVerificationAttributes + */ + public static CreateCustomerTokenVerificationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCustomerTokenVerificationAttributes.class); + } + + /** + * Convert an instance of CreateCustomerTokenVerificationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateDepositAccount.java b/src/main/java/org/openapitools/client/model/CreateDepositAccount.java new file mode 100644 index 00000000..e9feb0a8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateDepositAccount.java @@ -0,0 +1,319 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateDepositAccountAttributes; +import org.openapitools.client.model.CreateDepositAccountRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateDepositAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateDepositAccount { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DEPOSITACCOUNT("depositAccount"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.DEPOSITACCOUNT; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateDepositAccountAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateDepositAccountRelationships relationships; + + public CreateDepositAccount() { + } + + public CreateDepositAccount type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateDepositAccount attributes(CreateDepositAccountAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CreateDepositAccountAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateDepositAccountAttributes attributes) { + this.attributes = attributes; + } + + + public CreateDepositAccount relationships(CreateDepositAccountRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CreateDepositAccountRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateDepositAccountRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDepositAccount createDepositAccount = (CreateDepositAccount) o; + return Objects.equals(this.type, createDepositAccount.type) && + Objects.equals(this.attributes, createDepositAccount.attributes) && + Objects.equals(this.relationships, createDepositAccount.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDepositAccount {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDepositAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDepositAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDepositAccount is not found in the empty JSON string", CreateDepositAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDepositAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDepositAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CreateDepositAccountAttributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + CreateDepositAccountRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDepositAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDepositAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateDepositAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDepositAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDepositAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDepositAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDepositAccount + * @throws IOException if the JSON string is invalid with respect to CreateDepositAccount + */ + public static CreateDepositAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDepositAccount.class); + } + + /** + * Convert an instance of CreateDepositAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateDepositAccountAttributes.java b/src/main/java/org/openapitools/client/model/CreateDepositAccountAttributes.java new file mode 100644 index 00000000..e5a5329f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateDepositAccountAttributes.java @@ -0,0 +1,287 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateDepositAccountAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateDepositAccountAttributes { + public static final String SERIALIZED_NAME_DEPOSIT_PRODUCT = "depositProduct"; + @SerializedName(SERIALIZED_NAME_DEPOSIT_PRODUCT) + private String depositProduct; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public CreateDepositAccountAttributes() { + } + + public CreateDepositAccountAttributes depositProduct(String depositProduct) { + + this.depositProduct = depositProduct; + return this; + } + + /** + * Get depositProduct + * @return depositProduct + **/ + @javax.annotation.Nonnull + public String getDepositProduct() { + return depositProduct; + } + + + public void setDepositProduct(String depositProduct) { + this.depositProduct = depositProduct; + } + + + public CreateDepositAccountAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateDepositAccountAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDepositAccountAttributes createDepositAccountAttributes = (CreateDepositAccountAttributes) o; + return Objects.equals(this.depositProduct, createDepositAccountAttributes.depositProduct) && + Objects.equals(this.tags, createDepositAccountAttributes.tags) && + Objects.equals(this.idempotencyKey, createDepositAccountAttributes.idempotencyKey); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(depositProduct, tags, idempotencyKey); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDepositAccountAttributes {\n"); + sb.append(" depositProduct: ").append(toIndentedString(depositProduct)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("depositProduct"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("depositProduct"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDepositAccountAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDepositAccountAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDepositAccountAttributes is not found in the empty JSON string", CreateDepositAccountAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDepositAccountAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDepositAccountAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateDepositAccountAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("depositProduct").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `depositProduct` to be a primitive type in the JSON string but got `%s`", jsonObj.get("depositProduct").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDepositAccountAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDepositAccountAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateDepositAccountAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDepositAccountAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDepositAccountAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDepositAccountAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDepositAccountAttributes + * @throws IOException if the JSON string is invalid with respect to CreateDepositAccountAttributes + */ + public static CreateDepositAccountAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDepositAccountAttributes.class); + } + + /** + * Convert an instance of CreateDepositAccountAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateDepositAccountRelationships.java b/src/main/java/org/openapitools/client/model/CreateDepositAccountRelationships.java new file mode 100644 index 00000000..41d78420 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateDepositAccountRelationships.java @@ -0,0 +1,243 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerLinkage; +import org.openapitools.client.model.CustomersRelationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateDepositAccountRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateDepositAccountRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private CustomerLinkage customer; + + public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; + @SerializedName(SERIALIZED_NAME_CUSTOMERS) + private CustomersRelationship customers; + + public CreateDepositAccountRelationships() { + } + + public CreateDepositAccountRelationships customer(CustomerLinkage customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public CustomerLinkage getCustomer() { + return customer; + } + + + public void setCustomer(CustomerLinkage customer) { + this.customer = customer; + } + + + public CreateDepositAccountRelationships customers(CustomersRelationship customers) { + + this.customers = customers; + return this; + } + + /** + * Get customers + * @return customers + **/ + @javax.annotation.Nullable + public CustomersRelationship getCustomers() { + return customers; + } + + + public void setCustomers(CustomersRelationship customers) { + this.customers = customers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateDepositAccountRelationships createDepositAccountRelationships = (CreateDepositAccountRelationships) o; + return Objects.equals(this.customer, createDepositAccountRelationships.customer) && + Objects.equals(this.customers, createDepositAccountRelationships.customers); + } + + @Override + public int hashCode() { + return Objects.hash(customer, customers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateDepositAccountRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + openapiFields.add("customers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDepositAccountRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateDepositAccountRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDepositAccountRelationships is not found in the empty JSON string", CreateDepositAccountRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateDepositAccountRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDepositAccountRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + CustomerLinkage.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `customers` + if (jsonObj.get("customers") != null && !jsonObj.get("customers").isJsonNull()) { + CustomersRelationship.validateJsonElement(jsonObj.get("customers")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDepositAccountRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDepositAccountRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateDepositAccountRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDepositAccountRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateDepositAccountRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateDepositAccountRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDepositAccountRelationships + * @throws IOException if the JSON string is invalid with respect to CreateDepositAccountRelationships + */ + public static CreateDepositAccountRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDepositAccountRelationships.class); + } + + /** + * Convert an instance of CreateDepositAccountRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateFee.java b/src/main/java/org/openapitools/client/model/CreateFee.java new file mode 100644 index 00000000..26ed541c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateFee.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateFeeAttributes; +import org.openapitools.client.model.CreateFeeRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateFee + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateFee { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + FEE("fee"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateFeeAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateFeeRelationships relationships; + + public CreateFee() { + } + + public CreateFee type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateFee attributes(CreateFeeAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateFeeAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateFeeAttributes attributes) { + this.attributes = attributes; + } + + + public CreateFee relationships(CreateFeeRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateFeeRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateFeeRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFee createFee = (CreateFee) o; + return Objects.equals(this.type, createFee.type) && + Objects.equals(this.attributes, createFee.attributes) && + Objects.equals(this.relationships, createFee.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFee {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFee is not found in the empty JSON string", CreateFee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFee.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateFeeAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateFeeRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFee given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFee + * @throws IOException if the JSON string is invalid with respect to CreateFee + */ + public static CreateFee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFee.class); + } + + /** + * Convert an instance of CreateFee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateFeeAttributes.java b/src/main/java/org/openapitools/client/model/CreateFeeAttributes.java new file mode 100644 index 00000000..83061f7c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateFeeAttributes.java @@ -0,0 +1,305 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateFeeAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateFeeAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public CreateFeeAttributes() { + } + + public CreateFeeAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateFeeAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateFeeAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateFeeAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFeeAttributes createFeeAttributes = (CreateFeeAttributes) o; + return Objects.equals(this.amount, createFeeAttributes.amount) && + Objects.equals(this.description, createFeeAttributes.description) && + Objects.equals(this.tags, createFeeAttributes.tags) && + Objects.equals(this.idempotencyKey, createFeeAttributes.idempotencyKey); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, tags, idempotencyKey); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFeeAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFeeAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFeeAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFeeAttributes is not found in the empty JSON string", CreateFeeAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFeeAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFeeAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFeeAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFeeAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFeeAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFeeAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFeeAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFeeAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFeeAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFeeAttributes + * @throws IOException if the JSON string is invalid with respect to CreateFeeAttributes + */ + public static CreateFeeAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFeeAttributes.class); + } + + /** + * Convert an instance of CreateFeeAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateFeeRelationships.java b/src/main/java/org/openapitools/client/model/CreateFeeRelationships.java new file mode 100644 index 00000000..32e0f470 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateFeeRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateFeeRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateFeeRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public CreateFeeRelationships() { + } + + public CreateFeeRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFeeRelationships createFeeRelationships = (CreateFeeRelationships) o; + return Objects.equals(this.account, createFeeRelationships.account); + } + + @Override + public int hashCode() { + return Objects.hash(account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFeeRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateFeeRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFeeRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateFeeRelationships is not found in the empty JSON string", CreateFeeRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFeeRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFeeRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFeeRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFeeRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFeeRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFeeRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFeeRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFeeRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFeeRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFeeRelationships + * @throws IOException if the JSON string is invalid with respect to CreateFeeRelationships + */ + public static CreateFeeRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFeeRelationships.class); + } + + /** + * Convert an instance of CreateFeeRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndividualApplication.java b/src/main/java/org/openapitools/client/model/CreateIndividualApplication.java new file mode 100644 index 00000000..bf17d2b1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateIndividualApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateIndividualApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateIndividualApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateIndividualApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "individualApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateIndividualApplicationAttributes attributes; + + public CreateIndividualApplication() { + } + + public CreateIndividualApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateIndividualApplication attributes(CreateIndividualApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateIndividualApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateIndividualApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndividualApplication createIndividualApplication = (CreateIndividualApplication) o; + return Objects.equals(this.type, createIndividualApplication.type) && + Objects.equals(this.attributes, createIndividualApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndividualApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndividualApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndividualApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndividualApplication is not found in the empty JSON string", CreateIndividualApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateIndividualApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndividualApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIndividualApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateIndividualApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndividualApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndividualApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndividualApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateIndividualApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndividualApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndividualApplication + * @throws IOException if the JSON string is invalid with respect to CreateIndividualApplication + */ + public static CreateIndividualApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndividualApplication.class); + } + + /** + * Convert an instance of CreateIndividualApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndividualApplicationAttributes.java b/src/main/java/org/openapitools/client/model/CreateIndividualApplicationAttributes.java new file mode 100644 index 00000000..ebdef679 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateIndividualApplicationAttributes.java @@ -0,0 +1,803 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.CreatePowerOfAttorneyAgent; +import org.openapitools.client.model.DeviceFingerprint; +import org.openapitools.client.model.EvaluationParams; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Industry; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.SourceOfIncome; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateIndividualApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateIndividualApplicationAttributes { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_DEVICE_FINGERPRINTS = "deviceFingerprints"; + @SerializedName(SERIALIZED_NAME_DEVICE_FINGERPRINTS) + private List deviceFingerprints; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public static final String SERIALIZED_NAME_POWER_OF_ATTORNEY_AGENT = "powerOfAttorneyAgent"; + @SerializedName(SERIALIZED_NAME_POWER_OF_ATTORNEY_AGENT) + private CreatePowerOfAttorneyAgent powerOfAttorneyAgent; + + public static final String SERIALIZED_NAME_INDUSTRY = "industry"; + @SerializedName(SERIALIZED_NAME_INDUSTRY) + private Industry industry; + + public static final String SERIALIZED_NAME_EVALUATION_PARAMS = "evaluationParams"; + @SerializedName(SERIALIZED_NAME_EVALUATION_PARAMS) + private EvaluationParams evaluationParams; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public CreateIndividualApplicationAttributes() { + } + + public CreateIndividualApplicationAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateIndividualApplicationAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateIndividualApplicationAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateIndividualApplicationAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreateIndividualApplicationAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreateIndividualApplicationAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreateIndividualApplicationAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateIndividualApplicationAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateIndividualApplicationAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public CreateIndividualApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateIndividualApplicationAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateIndividualApplicationAttributes deviceFingerprints(List deviceFingerprints) { + + this.deviceFingerprints = deviceFingerprints; + return this; + } + + public CreateIndividualApplicationAttributes addDeviceFingerprintsItem(DeviceFingerprint deviceFingerprintsItem) { + if (this.deviceFingerprints == null) { + this.deviceFingerprints = new ArrayList<>(); + } + this.deviceFingerprints.add(deviceFingerprintsItem); + return this; + } + + /** + * Get deviceFingerprints + * @return deviceFingerprints + **/ + @javax.annotation.Nullable + public List getDeviceFingerprints() { + return deviceFingerprints; + } + + + public void setDeviceFingerprints(List deviceFingerprints) { + this.deviceFingerprints = deviceFingerprints; + } + + + public CreateIndividualApplicationAttributes jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + public CreateIndividualApplicationAttributes powerOfAttorneyAgent(CreatePowerOfAttorneyAgent powerOfAttorneyAgent) { + + this.powerOfAttorneyAgent = powerOfAttorneyAgent; + return this; + } + + /** + * Get powerOfAttorneyAgent + * @return powerOfAttorneyAgent + **/ + @javax.annotation.Nullable + public CreatePowerOfAttorneyAgent getPowerOfAttorneyAgent() { + return powerOfAttorneyAgent; + } + + + public void setPowerOfAttorneyAgent(CreatePowerOfAttorneyAgent powerOfAttorneyAgent) { + this.powerOfAttorneyAgent = powerOfAttorneyAgent; + } + + + public CreateIndividualApplicationAttributes industry(Industry industry) { + + this.industry = industry; + return this; + } + + /** + * Get industry + * @return industry + **/ + @javax.annotation.Nullable + public Industry getIndustry() { + return industry; + } + + + public void setIndustry(Industry industry) { + this.industry = industry; + } + + + public CreateIndividualApplicationAttributes evaluationParams(EvaluationParams evaluationParams) { + + this.evaluationParams = evaluationParams; + return this; + } + + /** + * Get evaluationParams + * @return evaluationParams + **/ + @javax.annotation.Nullable + public EvaluationParams getEvaluationParams() { + return evaluationParams; + } + + + public void setEvaluationParams(EvaluationParams evaluationParams) { + this.evaluationParams = evaluationParams; + } + + + public CreateIndividualApplicationAttributes occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public CreateIndividualApplicationAttributes annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public CreateIndividualApplicationAttributes sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndividualApplicationAttributes createIndividualApplicationAttributes = (CreateIndividualApplicationAttributes) o; + return Objects.equals(this.fullName, createIndividualApplicationAttributes.fullName) && + Objects.equals(this.email, createIndividualApplicationAttributes.email) && + Objects.equals(this.phone, createIndividualApplicationAttributes.phone) && + Objects.equals(this.ssn, createIndividualApplicationAttributes.ssn) && + Objects.equals(this.passport, createIndividualApplicationAttributes.passport) && + Objects.equals(this.nationality, createIndividualApplicationAttributes.nationality) && + Objects.equals(this.address, createIndividualApplicationAttributes.address) && + Objects.equals(this.dateOfBirth, createIndividualApplicationAttributes.dateOfBirth) && + Objects.equals(this.ip, createIndividualApplicationAttributes.ip) && + Objects.equals(this.tags, createIndividualApplicationAttributes.tags) && + Objects.equals(this.idempotencyKey, createIndividualApplicationAttributes.idempotencyKey) && + Objects.equals(this.deviceFingerprints, createIndividualApplicationAttributes.deviceFingerprints) && + Objects.equals(this.jwtSubject, createIndividualApplicationAttributes.jwtSubject) && + Objects.equals(this.powerOfAttorneyAgent, createIndividualApplicationAttributes.powerOfAttorneyAgent) && + Objects.equals(this.industry, createIndividualApplicationAttributes.industry) && + Objects.equals(this.evaluationParams, createIndividualApplicationAttributes.evaluationParams) && + Objects.equals(this.occupation, createIndividualApplicationAttributes.occupation) && + Objects.equals(this.annualIncome, createIndividualApplicationAttributes.annualIncome) && + Objects.equals(this.sourceOfIncome, createIndividualApplicationAttributes.sourceOfIncome); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, nationality, address, dateOfBirth, ip, tags, idempotencyKey, deviceFingerprints, jwtSubject, powerOfAttorneyAgent, industry, evaluationParams, occupation, annualIncome, sourceOfIncome); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndividualApplicationAttributes {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" deviceFingerprints: ").append(toIndentedString(deviceFingerprints)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append(" powerOfAttorneyAgent: ").append(toIndentedString(powerOfAttorneyAgent)).append("\n"); + sb.append(" industry: ").append(toIndentedString(industry)).append("\n"); + sb.append(" evaluationParams: ").append(toIndentedString(evaluationParams)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("ip"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + openapiFields.add("deviceFingerprints"); + openapiFields.add("jwtSubject"); + openapiFields.add("powerOfAttorneyAgent"); + openapiFields.add("industry"); + openapiFields.add("evaluationParams"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndividualApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndividualApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndividualApplicationAttributes is not found in the empty JSON string", CreateIndividualApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateIndividualApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndividualApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIndividualApplicationAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if (jsonObj.get("deviceFingerprints") != null && !jsonObj.get("deviceFingerprints").isJsonNull()) { + JsonArray jsonArraydeviceFingerprints = jsonObj.getAsJsonArray("deviceFingerprints"); + if (jsonArraydeviceFingerprints != null) { + // ensure the json data is an array + if (!jsonObj.get("deviceFingerprints").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `deviceFingerprints` to be an array in the JSON string but got `%s`", jsonObj.get("deviceFingerprints").toString())); + } + + // validate the optional field `deviceFingerprints` (array) + for (int i = 0; i < jsonArraydeviceFingerprints.size(); i++) { + DeviceFingerprint.validateJsonElement(jsonArraydeviceFingerprints.get(i)); + }; + } + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + // validate the optional field `powerOfAttorneyAgent` + if (jsonObj.get("powerOfAttorneyAgent") != null && !jsonObj.get("powerOfAttorneyAgent").isJsonNull()) { + CreatePowerOfAttorneyAgent.validateJsonElement(jsonObj.get("powerOfAttorneyAgent")); + } + // validate the optional field `evaluationParams` + if (jsonObj.get("evaluationParams") != null && !jsonObj.get("evaluationParams").isJsonNull()) { + EvaluationParams.validateJsonElement(jsonObj.get("evaluationParams")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndividualApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndividualApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndividualApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateIndividualApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndividualApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndividualApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to CreateIndividualApplicationAttributes + */ + public static CreateIndividualApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndividualApplicationAttributes.class); + } + + /** + * Convert an instance of CreateIndividualApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndividualDebitCard.java b/src/main/java/org/openapitools/client/model/CreateIndividualDebitCard.java new file mode 100644 index 00000000..cf9e1e07 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateIndividualDebitCard.java @@ -0,0 +1,335 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCardRelationships; +import org.openapitools.client.model.CreateIndividualDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateIndividualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateIndividualDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + INDIVIDUALDEBITCARD("individualDebitCard"), + + BUSINESSDEBITCARD("businessDebitCard"), + + BUSINESSCREDITCARD("businessCreditCard"), + + INDIVIDUALVIRTUALDEBITCARD("individualVirtualDebitCard"), + + BUSINESSVIRTUALDEBITCARD("businessVirtualDebitCard"), + + BUSINESSVIRTUALCREDITCARD("businessVirtualCreditCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.INDIVIDUALDEBITCARD; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateIndividualDebitCardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCardRelationships relationships; + + public CreateIndividualDebitCard() { + } + + public CreateIndividualDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateIndividualDebitCard attributes(CreateIndividualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateIndividualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateIndividualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateIndividualDebitCard relationships(CreateCardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndividualDebitCard createIndividualDebitCard = (CreateIndividualDebitCard) o; + return Objects.equals(this.type, createIndividualDebitCard.type) && + Objects.equals(this.attributes, createIndividualDebitCard.attributes) && + Objects.equals(this.relationships, createIndividualDebitCard.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndividualDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndividualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndividualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndividualDebitCard is not found in the empty JSON string", CreateIndividualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateIndividualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndividualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIndividualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateIndividualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndividualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndividualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndividualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateIndividualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndividualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndividualDebitCard + * @throws IOException if the JSON string is invalid with respect to CreateIndividualDebitCard + */ + public static CreateIndividualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndividualDebitCard.class); + } + + /** + * Convert an instance of CreateIndividualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndividualDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/CreateIndividualDebitCardAttributes.java new file mode 100644 index 00000000..ef2ddd04 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateIndividualDebitCardAttributes.java @@ -0,0 +1,546 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.BIN; +import org.openapitools.client.model.CardLevelLimits; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateIndividualDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateIndividualDebitCardAttributes { + public static final String SERIALIZED_NAME_SHIPPING_ADDRESS = "shippingAddress"; + @SerializedName(SERIALIZED_NAME_SHIPPING_ADDRESS) + private Address shippingAddress; + + public static final String SERIALIZED_NAME_DESIGN = "design"; + @SerializedName(SERIALIZED_NAME_DESIGN) + private String design; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private BIN bin; + + public static final String SERIALIZED_NAME_CARD_QUALIFIER = "cardQualifier"; + @SerializedName(SERIALIZED_NAME_CARD_QUALIFIER) + private String cardQualifier; + + public static final String SERIALIZED_NAME_CARD_DESIGN_ID = "cardDesignId"; + @SerializedName(SERIALIZED_NAME_CARD_DESIGN_ID) + private String cardDesignId; + + public static final String SERIALIZED_NAME_ADDITIONAL_EMBOSSED_TEXT = "additionalEmbossedText"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_EMBOSSED_TEXT) + private String additionalEmbossedText; + + public static final String SERIALIZED_NAME_ACTIVE_FOR_ONLINE_USE = "activeForOnlineUse"; + @SerializedName(SERIALIZED_NAME_ACTIVE_FOR_ONLINE_USE) + private Boolean activeForOnlineUse; + + public static final String SERIALIZED_NAME_PRINT_ONLY_BUSINESS_NAME = "printOnlyBusinessName"; + @SerializedName(SERIALIZED_NAME_PRINT_ONLY_BUSINESS_NAME) + private Boolean printOnlyBusinessName; + + public static final String SERIALIZED_NAME_EXPIRY_DATE = "expiryDate"; + @SerializedName(SERIALIZED_NAME_EXPIRY_DATE) + private String expiryDate; + + public CreateIndividualDebitCardAttributes() { + } + + public CreateIndividualDebitCardAttributes shippingAddress(Address shippingAddress) { + + this.shippingAddress = shippingAddress; + return this; + } + + /** + * Get shippingAddress + * @return shippingAddress + **/ + @javax.annotation.Nullable + public Address getShippingAddress() { + return shippingAddress; + } + + + public void setShippingAddress(Address shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public CreateIndividualDebitCardAttributes design(String design) { + + this.design = design; + return this; + } + + /** + * Get design + * @return design + **/ + @javax.annotation.Nullable + public String getDesign() { + return design; + } + + + public void setDesign(String design) { + this.design = design; + } + + + public CreateIndividualDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateIndividualDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public CreateIndividualDebitCardAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateIndividualDebitCardAttributes bin(BIN bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nullable + public BIN getBin() { + return bin; + } + + + public void setBin(BIN bin) { + this.bin = bin; + } + + + public CreateIndividualDebitCardAttributes cardQualifier(String cardQualifier) { + + this.cardQualifier = cardQualifier; + return this; + } + + /** + * Get cardQualifier + * @return cardQualifier + **/ + @javax.annotation.Nullable + public String getCardQualifier() { + return cardQualifier; + } + + + public void setCardQualifier(String cardQualifier) { + this.cardQualifier = cardQualifier; + } + + + public CreateIndividualDebitCardAttributes cardDesignId(String cardDesignId) { + + this.cardDesignId = cardDesignId; + return this; + } + + /** + * Get cardDesignId + * @return cardDesignId + **/ + @javax.annotation.Nullable + public String getCardDesignId() { + return cardDesignId; + } + + + public void setCardDesignId(String cardDesignId) { + this.cardDesignId = cardDesignId; + } + + + public CreateIndividualDebitCardAttributes additionalEmbossedText(String additionalEmbossedText) { + + this.additionalEmbossedText = additionalEmbossedText; + return this; + } + + /** + * Get additionalEmbossedText + * @return additionalEmbossedText + **/ + @javax.annotation.Nullable + public String getAdditionalEmbossedText() { + return additionalEmbossedText; + } + + + public void setAdditionalEmbossedText(String additionalEmbossedText) { + this.additionalEmbossedText = additionalEmbossedText; + } + + + public CreateIndividualDebitCardAttributes activeForOnlineUse(Boolean activeForOnlineUse) { + + this.activeForOnlineUse = activeForOnlineUse; + return this; + } + + /** + * Get activeForOnlineUse + * @return activeForOnlineUse + **/ + @javax.annotation.Nullable + public Boolean getActiveForOnlineUse() { + return activeForOnlineUse; + } + + + public void setActiveForOnlineUse(Boolean activeForOnlineUse) { + this.activeForOnlineUse = activeForOnlineUse; + } + + + public CreateIndividualDebitCardAttributes printOnlyBusinessName(Boolean printOnlyBusinessName) { + + this.printOnlyBusinessName = printOnlyBusinessName; + return this; + } + + /** + * Get printOnlyBusinessName + * @return printOnlyBusinessName + **/ + @javax.annotation.Nullable + public Boolean getPrintOnlyBusinessName() { + return printOnlyBusinessName; + } + + + public void setPrintOnlyBusinessName(Boolean printOnlyBusinessName) { + this.printOnlyBusinessName = printOnlyBusinessName; + } + + + public CreateIndividualDebitCardAttributes expiryDate(String expiryDate) { + + this.expiryDate = expiryDate; + return this; + } + + /** + * Get expiryDate + * @return expiryDate + **/ + @javax.annotation.Nullable + public String getExpiryDate() { + return expiryDate; + } + + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndividualDebitCardAttributes createIndividualDebitCardAttributes = (CreateIndividualDebitCardAttributes) o; + return Objects.equals(this.shippingAddress, createIndividualDebitCardAttributes.shippingAddress) && + Objects.equals(this.design, createIndividualDebitCardAttributes.design) && + Objects.equals(this.tags, createIndividualDebitCardAttributes.tags) && + Objects.equals(this.limits, createIndividualDebitCardAttributes.limits) && + Objects.equals(this.idempotencyKey, createIndividualDebitCardAttributes.idempotencyKey) && + Objects.equals(this.bin, createIndividualDebitCardAttributes.bin) && + Objects.equals(this.cardQualifier, createIndividualDebitCardAttributes.cardQualifier) && + Objects.equals(this.cardDesignId, createIndividualDebitCardAttributes.cardDesignId) && + Objects.equals(this.additionalEmbossedText, createIndividualDebitCardAttributes.additionalEmbossedText) && + Objects.equals(this.activeForOnlineUse, createIndividualDebitCardAttributes.activeForOnlineUse) && + Objects.equals(this.printOnlyBusinessName, createIndividualDebitCardAttributes.printOnlyBusinessName) && + Objects.equals(this.expiryDate, createIndividualDebitCardAttributes.expiryDate); + } + + @Override + public int hashCode() { + return Objects.hash(shippingAddress, design, tags, limits, idempotencyKey, bin, cardQualifier, cardDesignId, additionalEmbossedText, activeForOnlineUse, printOnlyBusinessName, expiryDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndividualDebitCardAttributes {\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" design: ").append(toIndentedString(design)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" cardQualifier: ").append(toIndentedString(cardQualifier)).append("\n"); + sb.append(" cardDesignId: ").append(toIndentedString(cardDesignId)).append("\n"); + sb.append(" additionalEmbossedText: ").append(toIndentedString(additionalEmbossedText)).append("\n"); + sb.append(" activeForOnlineUse: ").append(toIndentedString(activeForOnlineUse)).append("\n"); + sb.append(" printOnlyBusinessName: ").append(toIndentedString(printOnlyBusinessName)).append("\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingAddress"); + openapiFields.add("design"); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("idempotencyKey"); + openapiFields.add("bin"); + openapiFields.add("cardQualifier"); + openapiFields.add("cardDesignId"); + openapiFields.add("additionalEmbossedText"); + openapiFields.add("activeForOnlineUse"); + openapiFields.add("printOnlyBusinessName"); + openapiFields.add("expiryDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndividualDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndividualDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndividualDebitCardAttributes is not found in the empty JSON string", CreateIndividualDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateIndividualDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndividualDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `shippingAddress` + if (jsonObj.get("shippingAddress") != null && !jsonObj.get("shippingAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("shippingAddress")); + } + if ((jsonObj.get("design") != null && !jsonObj.get("design").isJsonNull()) && !jsonObj.get("design").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `design` to be a primitive type in the JSON string but got `%s`", jsonObj.get("design").toString())); + } + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + // validate the optional field `bin` + if (jsonObj.get("bin") != null && !jsonObj.get("bin").isJsonNull()) { + BIN.validateJsonElement(jsonObj.get("bin")); + } + if ((jsonObj.get("cardQualifier") != null && !jsonObj.get("cardQualifier").isJsonNull()) && !jsonObj.get("cardQualifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardQualifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardQualifier").toString())); + } + if ((jsonObj.get("cardDesignId") != null && !jsonObj.get("cardDesignId").isJsonNull()) && !jsonObj.get("cardDesignId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardDesignId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardDesignId").toString())); + } + if ((jsonObj.get("additionalEmbossedText") != null && !jsonObj.get("additionalEmbossedText").isJsonNull()) && !jsonObj.get("additionalEmbossedText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalEmbossedText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalEmbossedText").toString())); + } + if ((jsonObj.get("expiryDate") != null && !jsonObj.get("expiryDate").isJsonNull()) && !jsonObj.get("expiryDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiryDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiryDate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndividualDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndividualDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndividualDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateIndividualDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndividualDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndividualDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to CreateIndividualDebitCardAttributes + */ + public static CreateIndividualDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndividualDebitCardAttributes.class); + } + + /** + * Convert an instance of CreateIndividualDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndividualVirtualDebitCard.java b/src/main/java/org/openapitools/client/model/CreateIndividualVirtualDebitCard.java new file mode 100644 index 00000000..dd3ea0f7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateIndividualVirtualDebitCard.java @@ -0,0 +1,325 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCardRelationships; +import org.openapitools.client.model.CreateIndividualVirtualDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateIndividualVirtualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateIndividualVirtualDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + INDIVIDUALVIRTUALDEBITCARD("individualVirtualDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.INDIVIDUALVIRTUALDEBITCARD; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateIndividualVirtualDebitCardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCardRelationships relationships; + + public CreateIndividualVirtualDebitCard() { + } + + public CreateIndividualVirtualDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreateIndividualVirtualDebitCard attributes(CreateIndividualVirtualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateIndividualVirtualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateIndividualVirtualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateIndividualVirtualDebitCard relationships(CreateCardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndividualVirtualDebitCard createIndividualVirtualDebitCard = (CreateIndividualVirtualDebitCard) o; + return Objects.equals(this.type, createIndividualVirtualDebitCard.type) && + Objects.equals(this.attributes, createIndividualVirtualDebitCard.attributes) && + Objects.equals(this.relationships, createIndividualVirtualDebitCard.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndividualVirtualDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndividualVirtualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndividualVirtualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndividualVirtualDebitCard is not found in the empty JSON string", CreateIndividualVirtualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateIndividualVirtualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndividualVirtualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIndividualVirtualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateIndividualVirtualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndividualVirtualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndividualVirtualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualVirtualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndividualVirtualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateIndividualVirtualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndividualVirtualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndividualVirtualDebitCard + * @throws IOException if the JSON string is invalid with respect to CreateIndividualVirtualDebitCard + */ + public static CreateIndividualVirtualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndividualVirtualDebitCard.class); + } + + /** + * Convert an instance of CreateIndividualVirtualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndividualVirtualDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/CreateIndividualVirtualDebitCardAttributes.java new file mode 100644 index 00000000..90a65b6e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateIndividualVirtualDebitCardAttributes.java @@ -0,0 +1,364 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.BIN; +import org.openapitools.client.model.CardLevelLimits; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateIndividualVirtualDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateIndividualVirtualDebitCardAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private BIN bin; + + public static final String SERIALIZED_NAME_CARD_QUALIFIER = "cardQualifier"; + @SerializedName(SERIALIZED_NAME_CARD_QUALIFIER) + private String cardQualifier; + + public static final String SERIALIZED_NAME_EXPIRY_DATE = "expiryDate"; + @SerializedName(SERIALIZED_NAME_EXPIRY_DATE) + private String expiryDate; + + public CreateIndividualVirtualDebitCardAttributes() { + } + + public CreateIndividualVirtualDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateIndividualVirtualDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public CreateIndividualVirtualDebitCardAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateIndividualVirtualDebitCardAttributes bin(BIN bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nullable + public BIN getBin() { + return bin; + } + + + public void setBin(BIN bin) { + this.bin = bin; + } + + + public CreateIndividualVirtualDebitCardAttributes cardQualifier(String cardQualifier) { + + this.cardQualifier = cardQualifier; + return this; + } + + /** + * Get cardQualifier + * @return cardQualifier + **/ + @javax.annotation.Nullable + public String getCardQualifier() { + return cardQualifier; + } + + + public void setCardQualifier(String cardQualifier) { + this.cardQualifier = cardQualifier; + } + + + public CreateIndividualVirtualDebitCardAttributes expiryDate(String expiryDate) { + + this.expiryDate = expiryDate; + return this; + } + + /** + * Get expiryDate + * @return expiryDate + **/ + @javax.annotation.Nullable + public String getExpiryDate() { + return expiryDate; + } + + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndividualVirtualDebitCardAttributes createIndividualVirtualDebitCardAttributes = (CreateIndividualVirtualDebitCardAttributes) o; + return Objects.equals(this.tags, createIndividualVirtualDebitCardAttributes.tags) && + Objects.equals(this.limits, createIndividualVirtualDebitCardAttributes.limits) && + Objects.equals(this.idempotencyKey, createIndividualVirtualDebitCardAttributes.idempotencyKey) && + Objects.equals(this.bin, createIndividualVirtualDebitCardAttributes.bin) && + Objects.equals(this.cardQualifier, createIndividualVirtualDebitCardAttributes.cardQualifier) && + Objects.equals(this.expiryDate, createIndividualVirtualDebitCardAttributes.expiryDate); + } + + @Override + public int hashCode() { + return Objects.hash(tags, limits, idempotencyKey, bin, cardQualifier, expiryDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndividualVirtualDebitCardAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" cardQualifier: ").append(toIndentedString(cardQualifier)).append("\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("idempotencyKey"); + openapiFields.add("bin"); + openapiFields.add("cardQualifier"); + openapiFields.add("expiryDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndividualVirtualDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndividualVirtualDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndividualVirtualDebitCardAttributes is not found in the empty JSON string", CreateIndividualVirtualDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateIndividualVirtualDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndividualVirtualDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + // validate the optional field `bin` + if (jsonObj.get("bin") != null && !jsonObj.get("bin").isJsonNull()) { + BIN.validateJsonElement(jsonObj.get("bin")); + } + if ((jsonObj.get("cardQualifier") != null && !jsonObj.get("cardQualifier").isJsonNull()) && !jsonObj.get("cardQualifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardQualifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardQualifier").toString())); + } + if ((jsonObj.get("expiryDate") != null && !jsonObj.get("expiryDate").isJsonNull()) && !jsonObj.get("expiryDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiryDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiryDate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndividualVirtualDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndividualVirtualDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndividualVirtualDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndividualVirtualDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateIndividualVirtualDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndividualVirtualDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndividualVirtualDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to CreateIndividualVirtualDebitCardAttributes + */ + public static CreateIndividualVirtualDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndividualVirtualDebitCardAttributes.class); + } + + /** + * Convert an instance of CreateIndividualVirtualDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateOfficer.java b/src/main/java/org/openapitools/client/model/CreateOfficer.java new file mode 100644 index 00000000..443cc4d9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateOfficer.java @@ -0,0 +1,689 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.EvaluationParams; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.SourceOfIncome; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateOfficer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateOfficer { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + /** + * Gets or Sets title + */ + @JsonAdapter(TitleEnum.Adapter.class) + public enum TitleEnum { + PRESIDENT("President"), + + CEO("CEO"), + + COO("COO"), + + CFO("CFO"), + + BENEFITSADMINISTRATIONOFFICER("BenefitsAdministrationOfficer"), + + CIO("CIO"), + + VP("VP"), + + AVP("AVP"), + + TREASURER("Treasurer"), + + SECRETARY("Secretary"), + + CONTROLLER("Controller"), + + MANAGER("Manager"), + + PARTNER("Partner"), + + MEMBER("Member"); + + private String value; + + TitleEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TitleEnum fromValue(String value) { + for (TitleEnum b : TitleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TitleEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TitleEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TitleEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private TitleEnum title; + + public static final String SERIALIZED_NAME_EVALUATION_PARAMS = "evaluationParams"; + @SerializedName(SERIALIZED_NAME_EVALUATION_PARAMS) + private EvaluationParams evaluationParams; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public CreateOfficer() { + } + + public CreateOfficer fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateOfficer email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateOfficer phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateOfficer ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreateOfficer passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreateOfficer nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreateOfficer matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public CreateOfficer address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateOfficer dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateOfficer title(TitleEnum title) { + + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @javax.annotation.Nullable + public TitleEnum getTitle() { + return title; + } + + + public void setTitle(TitleEnum title) { + this.title = title; + } + + + public CreateOfficer evaluationParams(EvaluationParams evaluationParams) { + + this.evaluationParams = evaluationParams; + return this; + } + + /** + * Get evaluationParams + * @return evaluationParams + **/ + @javax.annotation.Nullable + public EvaluationParams getEvaluationParams() { + return evaluationParams; + } + + + public void setEvaluationParams(EvaluationParams evaluationParams) { + this.evaluationParams = evaluationParams; + } + + + public CreateOfficer occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nonnull + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public CreateOfficer annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public CreateOfficer sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOfficer createOfficer = (CreateOfficer) o; + return Objects.equals(this.fullName, createOfficer.fullName) && + Objects.equals(this.email, createOfficer.email) && + Objects.equals(this.phone, createOfficer.phone) && + Objects.equals(this.ssn, createOfficer.ssn) && + Objects.equals(this.passport, createOfficer.passport) && + Objects.equals(this.nationality, createOfficer.nationality) && + Objects.equals(this.matriculaConsular, createOfficer.matriculaConsular) && + Objects.equals(this.address, createOfficer.address) && + Objects.equals(this.dateOfBirth, createOfficer.dateOfBirth) && + Objects.equals(this.title, createOfficer.title) && + Objects.equals(this.evaluationParams, createOfficer.evaluationParams) && + Objects.equals(this.occupation, createOfficer.occupation) && + Objects.equals(this.annualIncome, createOfficer.annualIncome) && + Objects.equals(this.sourceOfIncome, createOfficer.sourceOfIncome); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, title, evaluationParams, occupation, annualIncome, sourceOfIncome); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOfficer {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" evaluationParams: ").append(toIndentedString(evaluationParams)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("title"); + openapiFields.add("evaluationParams"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + openapiRequiredFields.add("occupation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateOfficer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateOfficer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateOfficer is not found in the empty JSON string", CreateOfficer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateOfficer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateOfficer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateOfficer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + // validate the optional field `evaluationParams` + if (jsonObj.get("evaluationParams") != null && !jsonObj.get("evaluationParams").isJsonNull()) { + EvaluationParams.validateJsonElement(jsonObj.get("evaluationParams")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateOfficer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateOfficer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateOfficer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateOfficer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateOfficer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateOfficer given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateOfficer + * @throws IOException if the JSON string is invalid with respect to CreateOfficer + */ + public static CreateOfficer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateOfficer.class); + } + + /** + * Convert an instance of CreateOfficer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePayment.java b/src/main/java/org/openapitools/client/model/CreatePayment.java new file mode 100644 index 00000000..a98dae7e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePayment.java @@ -0,0 +1,525 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPayment; +import org.openapitools.client.model.CreateAchPaymentCounterparty; +import org.openapitools.client.model.CreateAchPaymentPlaid; +import org.openapitools.client.model.CreateAchPaymentRelationships; +import org.openapitools.client.model.CreateBillPayment; +import org.openapitools.client.model.CreateBookPayment; +import org.openapitools.client.model.CreatePushToCardPayment; +import org.openapitools.client.model.CreatePushToCardPaymentAttributes; +import org.openapitools.client.model.CreateWirePayment; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePayment extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreatePayment.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateAchPayment = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPayment.class)); + final TypeAdapter adapterCreateAchPaymentCounterparty = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentCounterparty.class)); + final TypeAdapter adapterCreateAchPaymentPlaid = gson.getDelegateAdapter(this, TypeToken.get(CreateAchPaymentPlaid.class)); + final TypeAdapter adapterCreateBookPayment = gson.getDelegateAdapter(this, TypeToken.get(CreateBookPayment.class)); + final TypeAdapter adapterCreateWirePayment = gson.getDelegateAdapter(this, TypeToken.get(CreateWirePayment.class)); + final TypeAdapter adapterCreateBillPayment = gson.getDelegateAdapter(this, TypeToken.get(CreateBillPayment.class)); + final TypeAdapter adapterCreatePushToCardPayment = gson.getDelegateAdapter(this, TypeToken.get(CreatePushToCardPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePayment value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateAchPayment` + if (value.getActualInstance() instanceof CreateAchPayment) { + JsonElement element = adapterCreateAchPayment.toJsonTree((CreateAchPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateAchPaymentCounterparty` + if (value.getActualInstance() instanceof CreateAchPaymentCounterparty) { + JsonElement element = adapterCreateAchPaymentCounterparty.toJsonTree((CreateAchPaymentCounterparty)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateAchPaymentPlaid` + if (value.getActualInstance() instanceof CreateAchPaymentPlaid) { + JsonElement element = adapterCreateAchPaymentPlaid.toJsonTree((CreateAchPaymentPlaid)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBookPayment` + if (value.getActualInstance() instanceof CreateBookPayment) { + JsonElement element = adapterCreateBookPayment.toJsonTree((CreateBookPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateWirePayment` + if (value.getActualInstance() instanceof CreateWirePayment) { + JsonElement element = adapterCreateWirePayment.toJsonTree((CreateWirePayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBillPayment` + if (value.getActualInstance() instanceof CreateBillPayment) { + JsonElement element = adapterCreateBillPayment.toJsonTree((CreateBillPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreatePushToCardPayment` + if (value.getActualInstance() instanceof CreatePushToCardPayment) { + JsonElement element = adapterCreatePushToCardPayment.toJsonTree((CreatePushToCardPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateAchPayment, CreateAchPaymentCounterparty, CreateAchPaymentPlaid, CreateBillPayment, CreateBookPayment, CreatePushToCardPayment, CreateWirePayment"); + } + + @Override + public CreatePayment read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateAchPayment + try { + // validate the JSON object to see if any exception is thrown + CreateAchPayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreateAchPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateAchPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateAchPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateAchPayment'", e); + } + // deserialize CreateAchPaymentCounterparty + try { + // validate the JSON object to see if any exception is thrown + CreateAchPaymentCounterparty.validateJsonElement(jsonElement); + actualAdapter = adapterCreateAchPaymentCounterparty; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateAchPaymentCounterparty'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateAchPaymentCounterparty failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateAchPaymentCounterparty'", e); + } + // deserialize CreateAchPaymentPlaid + try { + // validate the JSON object to see if any exception is thrown + CreateAchPaymentPlaid.validateJsonElement(jsonElement); + actualAdapter = adapterCreateAchPaymentPlaid; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateAchPaymentPlaid'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateAchPaymentPlaid failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateAchPaymentPlaid'", e); + } + // deserialize CreateBookPayment + try { + // validate the JSON object to see if any exception is thrown + CreateBookPayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBookPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBookPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBookPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBookPayment'", e); + } + // deserialize CreateWirePayment + try { + // validate the JSON object to see if any exception is thrown + CreateWirePayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreateWirePayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateWirePayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateWirePayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateWirePayment'", e); + } + // deserialize CreateBillPayment + try { + // validate the JSON object to see if any exception is thrown + CreateBillPayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBillPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBillPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBillPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBillPayment'", e); + } + // deserialize CreatePushToCardPayment + try { + // validate the JSON object to see if any exception is thrown + CreatePushToCardPayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreatePushToCardPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreatePushToCardPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreatePushToCardPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreatePushToCardPayment'", e); + } + + if (match == 1) { + CreatePayment ret = new CreatePayment(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreatePayment: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreatePayment() { + super("oneOf", Boolean.FALSE); + } + + public CreatePayment(CreateAchPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreatePayment(CreateAchPaymentCounterparty o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreatePayment(CreateAchPaymentPlaid o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreatePayment(CreateBillPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreatePayment(CreateBookPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreatePayment(CreatePushToCardPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreatePayment(CreateWirePayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateAchPayment", CreateAchPayment.class); + schemas.put("CreateAchPaymentCounterparty", CreateAchPaymentCounterparty.class); + schemas.put("CreateAchPaymentPlaid", CreateAchPaymentPlaid.class); + schemas.put("CreateBookPayment", CreateBookPayment.class); + schemas.put("CreateWirePayment", CreateWirePayment.class); + schemas.put("CreateBillPayment", CreateBillPayment.class); + schemas.put("CreatePushToCardPayment", CreatePushToCardPayment.class); + } + + @Override + public Map> getSchemas() { + return CreatePayment.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateAchPayment, CreateAchPaymentCounterparty, CreateAchPaymentPlaid, CreateBillPayment, CreateBookPayment, CreatePushToCardPayment, CreateWirePayment + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateAchPayment) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateAchPaymentCounterparty) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateAchPaymentPlaid) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBookPayment) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateWirePayment) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBillPayment) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreatePushToCardPayment) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateAchPayment, CreateAchPaymentCounterparty, CreateAchPaymentPlaid, CreateBillPayment, CreateBookPayment, CreatePushToCardPayment, CreateWirePayment"); + } + + /** + * Get the actual instance, which can be the following: + * CreateAchPayment, CreateAchPaymentCounterparty, CreateAchPaymentPlaid, CreateBillPayment, CreateBookPayment, CreatePushToCardPayment, CreateWirePayment + * + * @return The actual instance (CreateAchPayment, CreateAchPaymentCounterparty, CreateAchPaymentPlaid, CreateBillPayment, CreateBookPayment, CreatePushToCardPayment, CreateWirePayment) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateAchPayment`. If the actual instance is not `CreateAchPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateAchPayment` + * @throws ClassCastException if the instance is not `CreateAchPayment` + */ + public CreateAchPayment getCreateAchPayment() throws ClassCastException { + return (CreateAchPayment)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateAchPaymentCounterparty`. If the actual instance is not `CreateAchPaymentCounterparty`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateAchPaymentCounterparty` + * @throws ClassCastException if the instance is not `CreateAchPaymentCounterparty` + */ + public CreateAchPaymentCounterparty getCreateAchPaymentCounterparty() throws ClassCastException { + return (CreateAchPaymentCounterparty)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateAchPaymentPlaid`. If the actual instance is not `CreateAchPaymentPlaid`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateAchPaymentPlaid` + * @throws ClassCastException if the instance is not `CreateAchPaymentPlaid` + */ + public CreateAchPaymentPlaid getCreateAchPaymentPlaid() throws ClassCastException { + return (CreateAchPaymentPlaid)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBookPayment`. If the actual instance is not `CreateBookPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBookPayment` + * @throws ClassCastException if the instance is not `CreateBookPayment` + */ + public CreateBookPayment getCreateBookPayment() throws ClassCastException { + return (CreateBookPayment)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateWirePayment`. If the actual instance is not `CreateWirePayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateWirePayment` + * @throws ClassCastException if the instance is not `CreateWirePayment` + */ + public CreateWirePayment getCreateWirePayment() throws ClassCastException { + return (CreateWirePayment)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBillPayment`. If the actual instance is not `CreateBillPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBillPayment` + * @throws ClassCastException if the instance is not `CreateBillPayment` + */ + public CreateBillPayment getCreateBillPayment() throws ClassCastException { + return (CreateBillPayment)super.getActualInstance(); + } + /** + * Get the actual instance of `CreatePushToCardPayment`. If the actual instance is not `CreatePushToCardPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreatePushToCardPayment` + * @throws ClassCastException if the instance is not `CreatePushToCardPayment` + */ + public CreatePushToCardPayment getCreatePushToCardPayment() throws ClassCastException { + return (CreatePushToCardPayment)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateAchPayment + try { + CreateAchPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateAchPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateAchPaymentCounterparty + try { + CreateAchPaymentCounterparty.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateAchPaymentCounterparty failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateAchPaymentPlaid + try { + CreateAchPaymentPlaid.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateAchPaymentPlaid failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBookPayment + try { + CreateBookPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBookPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateWirePayment + try { + CreateWirePayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateWirePayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBillPayment + try { + CreateBillPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBillPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreatePushToCardPayment + try { + CreatePushToCardPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreatePushToCardPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreatePayment with oneOf schemas: CreateAchPayment, CreateAchPaymentCounterparty, CreateAchPaymentPlaid, CreateBillPayment, CreateBookPayment, CreatePushToCardPayment, CreateWirePayment. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreatePayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePayment + * @throws IOException if the JSON string is invalid with respect to CreatePayment + */ + public static CreatePayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePayment.class); + } + + /** + * Convert an instance of CreatePayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePlaidCounterparty.java b/src/main/java/org/openapitools/client/model/CreatePlaidCounterparty.java new file mode 100644 index 00000000..f868f479 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePlaidCounterparty.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCounterpartyRelationships; +import org.openapitools.client.model.CreatePlaidCounterpartyAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreatePlaidCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePlaidCounterparty { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreatePlaidCounterpartyAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateCounterpartyRelationships relationships; + + public CreatePlaidCounterparty() { + } + + public CreatePlaidCounterparty type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreatePlaidCounterparty attributes(CreatePlaidCounterpartyAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreatePlaidCounterpartyAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreatePlaidCounterpartyAttributes attributes) { + this.attributes = attributes; + } + + + public CreatePlaidCounterparty relationships(CreateCounterpartyRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateCounterpartyRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateCounterpartyRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePlaidCounterparty createPlaidCounterparty = (CreatePlaidCounterparty) o; + return Objects.equals(this.type, createPlaidCounterparty.type) && + Objects.equals(this.attributes, createPlaidCounterparty.attributes) && + Objects.equals(this.relationships, createPlaidCounterparty.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePlaidCounterparty {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePlaidCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePlaidCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePlaidCounterparty is not found in the empty JSON string", CreatePlaidCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePlaidCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePlaidCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePlaidCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreatePlaidCounterpartyAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateCounterpartyRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePlaidCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePlaidCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePlaidCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePlaidCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePlaidCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePlaidCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePlaidCounterparty + * @throws IOException if the JSON string is invalid with respect to CreatePlaidCounterparty + */ + public static CreatePlaidCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePlaidCounterparty.class); + } + + /** + * Convert an instance of CreatePlaidCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePlaidCounterpartyAttributes.java b/src/main/java/org/openapitools/client/model/CreatePlaidCounterpartyAttributes.java new file mode 100644 index 00000000..4357a796 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePlaidCounterpartyAttributes.java @@ -0,0 +1,495 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreatePlaidCounterpartyAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePlaidCounterpartyAttributes { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESS("Business"), + + PERSON("Person"), + + UNKNOWN("Unknown"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_VERIFY_NAME = "verifyName"; + @SerializedName(SERIALIZED_NAME_VERIFY_NAME) + private Boolean verifyName = false; + + public static final String SERIALIZED_NAME_PLAID_PROCESSOR_TOKEN = "plaidProcessorToken"; + @SerializedName(SERIALIZED_NAME_PLAID_PROCESSOR_TOKEN) + private String plaidProcessorToken; + + /** + * Gets or Sets permissions + */ + @JsonAdapter(PermissionsEnum.Adapter.class) + public enum PermissionsEnum { + CREDITONLY("CreditOnly"), + + DEBITONLY("DebitOnly"), + + CREDITANDDEBIT("CreditAndDebit"); + + private String value; + + PermissionsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PermissionsEnum fromValue(String value) { + for (PermissionsEnum b : PermissionsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PermissionsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PermissionsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PermissionsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private PermissionsEnum permissions; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public CreatePlaidCounterpartyAttributes() { + } + + public CreatePlaidCounterpartyAttributes type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CreatePlaidCounterpartyAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CreatePlaidCounterpartyAttributes verifyName(Boolean verifyName) { + + this.verifyName = verifyName; + return this; + } + + /** + * Get verifyName + * @return verifyName + **/ + @javax.annotation.Nullable + public Boolean getVerifyName() { + return verifyName; + } + + + public void setVerifyName(Boolean verifyName) { + this.verifyName = verifyName; + } + + + public CreatePlaidCounterpartyAttributes plaidProcessorToken(String plaidProcessorToken) { + + this.plaidProcessorToken = plaidProcessorToken; + return this; + } + + /** + * Get plaidProcessorToken + * @return plaidProcessorToken + **/ + @javax.annotation.Nonnull + public String getPlaidProcessorToken() { + return plaidProcessorToken; + } + + + public void setPlaidProcessorToken(String plaidProcessorToken) { + this.plaidProcessorToken = plaidProcessorToken; + } + + + public CreatePlaidCounterpartyAttributes permissions(PermissionsEnum permissions) { + + this.permissions = permissions; + return this; + } + + /** + * Get permissions + * @return permissions + **/ + @javax.annotation.Nullable + public PermissionsEnum getPermissions() { + return permissions; + } + + + public void setPermissions(PermissionsEnum permissions) { + this.permissions = permissions; + } + + + public CreatePlaidCounterpartyAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreatePlaidCounterpartyAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePlaidCounterpartyAttributes createPlaidCounterpartyAttributes = (CreatePlaidCounterpartyAttributes) o; + return Objects.equals(this.type, createPlaidCounterpartyAttributes.type) && + Objects.equals(this.name, createPlaidCounterpartyAttributes.name) && + Objects.equals(this.verifyName, createPlaidCounterpartyAttributes.verifyName) && + Objects.equals(this.plaidProcessorToken, createPlaidCounterpartyAttributes.plaidProcessorToken) && + Objects.equals(this.permissions, createPlaidCounterpartyAttributes.permissions) && + Objects.equals(this.tags, createPlaidCounterpartyAttributes.tags) && + Objects.equals(this.idempotencyKey, createPlaidCounterpartyAttributes.idempotencyKey); + } + + @Override + public int hashCode() { + return Objects.hash(type, name, verifyName, plaidProcessorToken, permissions, tags, idempotencyKey); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePlaidCounterpartyAttributes {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" verifyName: ").append(toIndentedString(verifyName)).append("\n"); + sb.append(" plaidProcessorToken: ").append(toIndentedString(plaidProcessorToken)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("verifyName"); + openapiFields.add("plaidProcessorToken"); + openapiFields.add("permissions"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("plaidProcessorToken"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePlaidCounterpartyAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePlaidCounterpartyAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePlaidCounterpartyAttributes is not found in the empty JSON string", CreatePlaidCounterpartyAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePlaidCounterpartyAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePlaidCounterpartyAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePlaidCounterpartyAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("plaidProcessorToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `plaidProcessorToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("plaidProcessorToken").toString())); + } + if ((jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) && !jsonObj.get("permissions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePlaidCounterpartyAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePlaidCounterpartyAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePlaidCounterpartyAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePlaidCounterpartyAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePlaidCounterpartyAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePlaidCounterpartyAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePlaidCounterpartyAttributes + * @throws IOException if the JSON string is invalid with respect to CreatePlaidCounterpartyAttributes + */ + public static CreatePlaidCounterpartyAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePlaidCounterpartyAttributes.class); + } + + /** + * Convert an instance of CreatePlaidCounterpartyAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePowerOfAttorneyAgent.java b/src/main/java/org/openapitools/client/model/CreatePowerOfAttorneyAgent.java new file mode 100644 index 00000000..db368b82 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePowerOfAttorneyAgent.java @@ -0,0 +1,542 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.EvaluationParams; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreatePowerOfAttorneyAgent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePowerOfAttorneyAgent { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public static final String SERIALIZED_NAME_EVALUATION_PARAMS = "evaluationParams"; + @SerializedName(SERIALIZED_NAME_EVALUATION_PARAMS) + private EvaluationParams evaluationParams; + + public CreatePowerOfAttorneyAgent() { + } + + public CreatePowerOfAttorneyAgent fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreatePowerOfAttorneyAgent email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreatePowerOfAttorneyAgent phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreatePowerOfAttorneyAgent ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreatePowerOfAttorneyAgent passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreatePowerOfAttorneyAgent nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreatePowerOfAttorneyAgent matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public CreatePowerOfAttorneyAgent address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreatePowerOfAttorneyAgent dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreatePowerOfAttorneyAgent jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + public CreatePowerOfAttorneyAgent evaluationParams(EvaluationParams evaluationParams) { + + this.evaluationParams = evaluationParams; + return this; + } + + /** + * Get evaluationParams + * @return evaluationParams + **/ + @javax.annotation.Nullable + public EvaluationParams getEvaluationParams() { + return evaluationParams; + } + + + public void setEvaluationParams(EvaluationParams evaluationParams) { + this.evaluationParams = evaluationParams; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePowerOfAttorneyAgent createPowerOfAttorneyAgent = (CreatePowerOfAttorneyAgent) o; + return Objects.equals(this.fullName, createPowerOfAttorneyAgent.fullName) && + Objects.equals(this.email, createPowerOfAttorneyAgent.email) && + Objects.equals(this.phone, createPowerOfAttorneyAgent.phone) && + Objects.equals(this.ssn, createPowerOfAttorneyAgent.ssn) && + Objects.equals(this.passport, createPowerOfAttorneyAgent.passport) && + Objects.equals(this.nationality, createPowerOfAttorneyAgent.nationality) && + Objects.equals(this.matriculaConsular, createPowerOfAttorneyAgent.matriculaConsular) && + Objects.equals(this.address, createPowerOfAttorneyAgent.address) && + Objects.equals(this.dateOfBirth, createPowerOfAttorneyAgent.dateOfBirth) && + Objects.equals(this.jwtSubject, createPowerOfAttorneyAgent.jwtSubject) && + Objects.equals(this.evaluationParams, createPowerOfAttorneyAgent.evaluationParams); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, jwtSubject, evaluationParams); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePowerOfAttorneyAgent {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append(" evaluationParams: ").append(toIndentedString(evaluationParams)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("jwtSubject"); + openapiFields.add("evaluationParams"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePowerOfAttorneyAgent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePowerOfAttorneyAgent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePowerOfAttorneyAgent is not found in the empty JSON string", CreatePowerOfAttorneyAgent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePowerOfAttorneyAgent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePowerOfAttorneyAgent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePowerOfAttorneyAgent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + // validate the optional field `evaluationParams` + if (jsonObj.get("evaluationParams") != null && !jsonObj.get("evaluationParams").isJsonNull()) { + EvaluationParams.validateJsonElement(jsonObj.get("evaluationParams")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePowerOfAttorneyAgent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePowerOfAttorneyAgent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePowerOfAttorneyAgent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePowerOfAttorneyAgent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePowerOfAttorneyAgent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePowerOfAttorneyAgent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePowerOfAttorneyAgent + * @throws IOException if the JSON string is invalid with respect to CreatePowerOfAttorneyAgent + */ + public static CreatePowerOfAttorneyAgent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePowerOfAttorneyAgent.class); + } + + /** + * Convert an instance of CreatePowerOfAttorneyAgent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePushToCardPayment.java b/src/main/java/org/openapitools/client/model/CreatePushToCardPayment.java new file mode 100644 index 00000000..c8aabc68 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePushToCardPayment.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPaymentRelationships; +import org.openapitools.client.model.CreatePushToCardPaymentAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreatePushToCardPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePushToCardPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "pushToCardPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreatePushToCardPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchPaymentRelationships relationships; + + public CreatePushToCardPayment() { + } + + public CreatePushToCardPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreatePushToCardPayment attributes(CreatePushToCardPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreatePushToCardPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreatePushToCardPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreatePushToCardPayment relationships(CreateAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePushToCardPayment createPushToCardPayment = (CreatePushToCardPayment) o; + return Objects.equals(this.type, createPushToCardPayment.type) && + Objects.equals(this.attributes, createPushToCardPayment.attributes) && + Objects.equals(this.relationships, createPushToCardPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePushToCardPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePushToCardPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePushToCardPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePushToCardPayment is not found in the empty JSON string", CreatePushToCardPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePushToCardPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePushToCardPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePushToCardPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreatePushToCardPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePushToCardPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePushToCardPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePushToCardPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePushToCardPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePushToCardPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePushToCardPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePushToCardPayment + * @throws IOException if the JSON string is invalid with respect to CreatePushToCardPayment + */ + public static CreatePushToCardPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePushToCardPayment.class); + } + + /** + * Convert an instance of CreatePushToCardPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePushToCardPaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreatePushToCardPaymentAttributes.java new file mode 100644 index 00000000..f05a70d1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePushToCardPaymentAttributes.java @@ -0,0 +1,336 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreatePushToCardPaymentAttributesConfiguration; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreatePushToCardPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePushToCardPaymentAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + private CreatePushToCardPaymentAttributesConfiguration _configuration; + + public CreatePushToCardPaymentAttributes() { + } + + public CreatePushToCardPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreatePushToCardPaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreatePushToCardPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreatePushToCardPaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreatePushToCardPaymentAttributes _configuration(CreatePushToCardPaymentAttributesConfiguration _configuration) { + + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + **/ + @javax.annotation.Nonnull + public CreatePushToCardPaymentAttributesConfiguration getConfiguration() { + return _configuration; + } + + + public void setConfiguration(CreatePushToCardPaymentAttributesConfiguration _configuration) { + this._configuration = _configuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePushToCardPaymentAttributes createPushToCardPaymentAttributes = (CreatePushToCardPaymentAttributes) o; + return Objects.equals(this.amount, createPushToCardPaymentAttributes.amount) && + Objects.equals(this.idempotencyKey, createPushToCardPaymentAttributes.idempotencyKey) && + Objects.equals(this.tags, createPushToCardPaymentAttributes.tags) && + Objects.equals(this.description, createPushToCardPaymentAttributes.description) && + Objects.equals(this._configuration, createPushToCardPaymentAttributes._configuration); + } + + @Override + public int hashCode() { + return Objects.hash(amount, idempotencyKey, tags, description, _configuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePushToCardPaymentAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + openapiFields.add("description"); + openapiFields.add("configuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("configuration"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePushToCardPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePushToCardPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePushToCardPaymentAttributes is not found in the empty JSON string", CreatePushToCardPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePushToCardPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePushToCardPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePushToCardPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `configuration` + CreatePushToCardPaymentAttributesConfiguration.validateJsonElement(jsonObj.get("configuration")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePushToCardPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePushToCardPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePushToCardPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePushToCardPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePushToCardPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePushToCardPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePushToCardPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreatePushToCardPaymentAttributes + */ + public static CreatePushToCardPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePushToCardPaymentAttributes.class); + } + + /** + * Convert an instance of CreatePushToCardPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreatePushToCardPaymentAttributesConfiguration.java b/src/main/java/org/openapitools/client/model/CreatePushToCardPaymentAttributesConfiguration.java new file mode 100644 index 00000000..d8657f3b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreatePushToCardPaymentAttributesConfiguration.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Astra; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreatePushToCardPaymentAttributesConfiguration + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePushToCardPaymentAttributesConfiguration { + public static final String SERIALIZED_NAME_ASTRA = "astra"; + @SerializedName(SERIALIZED_NAME_ASTRA) + private Astra astra; + + public CreatePushToCardPaymentAttributesConfiguration() { + } + + public CreatePushToCardPaymentAttributesConfiguration astra(Astra astra) { + + this.astra = astra; + return this; + } + + /** + * Get astra + * @return astra + **/ + @javax.annotation.Nullable + public Astra getAstra() { + return astra; + } + + + public void setAstra(Astra astra) { + this.astra = astra; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePushToCardPaymentAttributesConfiguration createPushToCardPaymentAttributesConfiguration = (CreatePushToCardPaymentAttributesConfiguration) o; + return Objects.equals(this.astra, createPushToCardPaymentAttributesConfiguration.astra); + } + + @Override + public int hashCode() { + return Objects.hash(astra); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePushToCardPaymentAttributesConfiguration {\n"); + sb.append(" astra: ").append(toIndentedString(astra)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("astra"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePushToCardPaymentAttributesConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePushToCardPaymentAttributesConfiguration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePushToCardPaymentAttributesConfiguration is not found in the empty JSON string", CreatePushToCardPaymentAttributesConfiguration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePushToCardPaymentAttributesConfiguration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePushToCardPaymentAttributesConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `astra` + if (jsonObj.get("astra") != null && !jsonObj.get("astra").isJsonNull()) { + Astra.validateJsonElement(jsonObj.get("astra")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePushToCardPaymentAttributesConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePushToCardPaymentAttributesConfiguration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePushToCardPaymentAttributesConfiguration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePushToCardPaymentAttributesConfiguration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePushToCardPaymentAttributesConfiguration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePushToCardPaymentAttributesConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePushToCardPaymentAttributesConfiguration + * @throws IOException if the JSON string is invalid with respect to CreatePushToCardPaymentAttributesConfiguration + */ + public static CreatePushToCardPaymentAttributesConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePushToCardPaymentAttributesConfiguration.class); + } + + /** + * Convert an instance of CreatePushToCardPaymentAttributesConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateRecurringPayment.java b/src/main/java/org/openapitools/client/model/CreateRecurringPayment.java new file mode 100644 index 00000000..6e37b4f9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateRecurringPayment.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateRecurringPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateRecurringPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public CreateRecurringPayment() { + } + + public CreateRecurringPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateRecurringPayment createRecurringPayment = (CreateRecurringPayment) o; + return Objects.equals(this.type, createRecurringPayment.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateRecurringPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateRecurringPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateRecurringPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateRecurringPayment is not found in the empty JSON string", CreateRecurringPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateRecurringPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateRecurringPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateRecurringPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateRecurringPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateRecurringPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateRecurringPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateRecurringPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateRecurringPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateRecurringPayment + * @throws IOException if the JSON string is invalid with respect to CreateRecurringPayment + */ + public static CreateRecurringPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateRecurringPayment.class); + } + + /** + * Convert an instance of CreateRecurringPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateRepayment.java b/src/main/java/org/openapitools/client/model/CreateRepayment.java new file mode 100644 index 00000000..14607fbe --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateRepayment.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateRepaymentData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateRepayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateRepayment { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateRepaymentData data; + + public CreateRepayment() { + } + + public CreateRepayment data(CreateRepaymentData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateRepaymentData getData() { + return data; + } + + + public void setData(CreateRepaymentData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateRepayment createRepayment = (CreateRepayment) o; + return Objects.equals(this.data, createRepayment.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateRepayment {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateRepayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateRepayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateRepayment is not found in the empty JSON string", CreateRepayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateRepayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateRepayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateRepaymentData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateRepayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateRepayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateRepayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateRepayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateRepayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateRepayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateRepayment + * @throws IOException if the JSON string is invalid with respect to CreateRepayment + */ + public static CreateRepayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateRepayment.class); + } + + /** + * Convert an instance of CreateRepayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateRepaymentData.java b/src/main/java/org/openapitools/client/model/CreateRepaymentData.java new file mode 100644 index 00000000..7f0db677 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateRepaymentData.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchRepayment; +import org.openapitools.client.model.CreateBookRepayment; +import org.openapitools.client.model.CreateBookRepaymentAttributes; +import org.openapitools.client.model.CreateBookRepaymentRelationships; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateRepaymentData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateRepaymentData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateRepaymentData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateRepaymentData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateAchRepayment = gson.getDelegateAdapter(this, TypeToken.get(CreateAchRepayment.class)); + final TypeAdapter adapterCreateBookRepayment = gson.getDelegateAdapter(this, TypeToken.get(CreateBookRepayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateRepaymentData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateAchRepayment` + if (value.getActualInstance() instanceof CreateAchRepayment) { + JsonElement element = adapterCreateAchRepayment.toJsonTree((CreateAchRepayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBookRepayment` + if (value.getActualInstance() instanceof CreateBookRepayment) { + JsonElement element = adapterCreateBookRepayment.toJsonTree((CreateBookRepayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateAchRepayment, CreateBookRepayment"); + } + + @Override + public CreateRepaymentData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateAchRepayment + try { + // validate the JSON object to see if any exception is thrown + CreateAchRepayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreateAchRepayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateAchRepayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateAchRepayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateAchRepayment'", e); + } + // deserialize CreateBookRepayment + try { + // validate the JSON object to see if any exception is thrown + CreateBookRepayment.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBookRepayment; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBookRepayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for CreateBookRepayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBookRepayment'", e); + } + + if (match == 1) { + CreateRepaymentData ret = new CreateRepaymentData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for CreateRepaymentData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateRepaymentData() { + super("oneOf", Boolean.FALSE); + } + + public CreateRepaymentData(CreateAchRepayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CreateRepaymentData(CreateBookRepayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateAchRepayment", CreateAchRepayment.class); + schemas.put("CreateBookRepayment", CreateBookRepayment.class); + } + + @Override + public Map> getSchemas() { + return CreateRepaymentData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateAchRepayment, CreateBookRepayment + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateAchRepayment) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBookRepayment) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateAchRepayment, CreateBookRepayment"); + } + + /** + * Get the actual instance, which can be the following: + * CreateAchRepayment, CreateBookRepayment + * + * @return The actual instance (CreateAchRepayment, CreateBookRepayment) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateAchRepayment`. If the actual instance is not `CreateAchRepayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateAchRepayment` + * @throws ClassCastException if the instance is not `CreateAchRepayment` + */ + public CreateAchRepayment getCreateAchRepayment() throws ClassCastException { + return (CreateAchRepayment)super.getActualInstance(); + } + /** + * Get the actual instance of `CreateBookRepayment`. If the actual instance is not `CreateBookRepayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBookRepayment` + * @throws ClassCastException if the instance is not `CreateBookRepayment` + */ + public CreateBookRepayment getCreateBookRepayment() throws ClassCastException { + return (CreateBookRepayment)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateRepaymentData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateAchRepayment + try { + CreateAchRepayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateAchRepayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBookRepayment + try { + CreateBookRepayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for CreateBookRepayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for CreateRepaymentData with oneOf schemas: CreateAchRepayment, CreateBookRepayment. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateRepaymentData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateRepaymentData + * @throws IOException if the JSON string is invalid with respect to CreateRepaymentData + */ + public static CreateRepaymentData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateRepaymentData.class); + } + + /** + * Convert an instance of CreateRepaymentData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateReward.java b/src/main/java/org/openapitools/client/model/CreateReward.java new file mode 100644 index 00000000..4fbd116c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateReward.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateRewardAttributes; +import org.openapitools.client.model.CreateRewardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateReward + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateReward { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "reward"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateRewardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateRewardRelationships relationships; + + public CreateReward() { + } + + public CreateReward type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateReward attributes(CreateRewardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateRewardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateRewardAttributes attributes) { + this.attributes = attributes; + } + + + public CreateReward relationships(CreateRewardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateRewardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateRewardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReward createReward = (CreateReward) o; + return Objects.equals(this.type, createReward.type) && + Objects.equals(this.attributes, createReward.attributes) && + Objects.equals(this.relationships, createReward.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateReward {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateReward + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateReward.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateReward is not found in the empty JSON string", CreateReward.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateReward.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateReward` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateReward.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateRewardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateRewardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateReward.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateReward' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateReward.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateReward value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateReward read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateReward given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateReward + * @throws IOException if the JSON string is invalid with respect to CreateReward + */ + public static CreateReward fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateReward.class); + } + + /** + * Convert an instance of CreateReward to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateRewardAttributes.java b/src/main/java/org/openapitools/client/model/CreateRewardAttributes.java new file mode 100644 index 00000000..b4bd68a3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateRewardAttributes.java @@ -0,0 +1,305 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateRewardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateRewardAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CreateRewardAttributes() { + } + + public CreateRewardAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateRewardAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateRewardAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateRewardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateRewardAttributes createRewardAttributes = (CreateRewardAttributes) o; + return Objects.equals(this.amount, createRewardAttributes.amount) && + Objects.equals(this.description, createRewardAttributes.description) && + Objects.equals(this.idempotencyKey, createRewardAttributes.idempotencyKey) && + Objects.equals(this.tags, createRewardAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, idempotencyKey, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateRewardAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateRewardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateRewardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateRewardAttributes is not found in the empty JSON string", CreateRewardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateRewardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateRewardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateRewardAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateRewardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateRewardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateRewardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateRewardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateRewardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateRewardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateRewardAttributes + * @throws IOException if the JSON string is invalid with respect to CreateRewardAttributes + */ + public static CreateRewardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateRewardAttributes.class); + } + + /** + * Convert an instance of CreateRewardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateRewardRelationships.java b/src/main/java/org/openapitools/client/model/CreateRewardRelationships.java new file mode 100644 index 00000000..fee51562 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateRewardRelationships.java @@ -0,0 +1,281 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransaction; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateRewardRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateRewardRelationships { + public static final String SERIALIZED_NAME_FUNDING_ACCOUNT = "fundingAccount"; + @SerializedName(SERIALIZED_NAME_FUNDING_ACCOUNT) + private Relationship fundingAccount; + + public static final String SERIALIZED_NAME_RECEIVING_ACCOUNT = "receivingAccount"; + @SerializedName(SERIALIZED_NAME_RECEIVING_ACCOUNT) + private Relationship receivingAccount; + + public static final String SERIALIZED_NAME_REWARDED_TRANSACTION = "rewardedTransaction"; + @SerializedName(SERIALIZED_NAME_REWARDED_TRANSACTION) + private ReceivedPaymentRelationshipsReceivePaymentTransaction rewardedTransaction; + + public CreateRewardRelationships() { + } + + public CreateRewardRelationships fundingAccount(Relationship fundingAccount) { + + this.fundingAccount = fundingAccount; + return this; + } + + /** + * Get fundingAccount + * @return fundingAccount + **/ + @javax.annotation.Nullable + public Relationship getFundingAccount() { + return fundingAccount; + } + + + public void setFundingAccount(Relationship fundingAccount) { + this.fundingAccount = fundingAccount; + } + + + public CreateRewardRelationships receivingAccount(Relationship receivingAccount) { + + this.receivingAccount = receivingAccount; + return this; + } + + /** + * Get receivingAccount + * @return receivingAccount + **/ + @javax.annotation.Nonnull + public Relationship getReceivingAccount() { + return receivingAccount; + } + + + public void setReceivingAccount(Relationship receivingAccount) { + this.receivingAccount = receivingAccount; + } + + + public CreateRewardRelationships rewardedTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction rewardedTransaction) { + + this.rewardedTransaction = rewardedTransaction; + return this; + } + + /** + * Get rewardedTransaction + * @return rewardedTransaction + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsReceivePaymentTransaction getRewardedTransaction() { + return rewardedTransaction; + } + + + public void setRewardedTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction rewardedTransaction) { + this.rewardedTransaction = rewardedTransaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateRewardRelationships createRewardRelationships = (CreateRewardRelationships) o; + return Objects.equals(this.fundingAccount, createRewardRelationships.fundingAccount) && + Objects.equals(this.receivingAccount, createRewardRelationships.receivingAccount) && + Objects.equals(this.rewardedTransaction, createRewardRelationships.rewardedTransaction); + } + + @Override + public int hashCode() { + return Objects.hash(fundingAccount, receivingAccount, rewardedTransaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateRewardRelationships {\n"); + sb.append(" fundingAccount: ").append(toIndentedString(fundingAccount)).append("\n"); + sb.append(" receivingAccount: ").append(toIndentedString(receivingAccount)).append("\n"); + sb.append(" rewardedTransaction: ").append(toIndentedString(rewardedTransaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fundingAccount"); + openapiFields.add("receivingAccount"); + openapiFields.add("rewardedTransaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("receivingAccount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateRewardRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateRewardRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateRewardRelationships is not found in the empty JSON string", CreateRewardRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateRewardRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateRewardRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateRewardRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `fundingAccount` + if (jsonObj.get("fundingAccount") != null && !jsonObj.get("fundingAccount").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("fundingAccount")); + } + // validate the required field `receivingAccount` + Relationship.validateJsonElement(jsonObj.get("receivingAccount")); + // validate the optional field `rewardedTransaction` + if (jsonObj.get("rewardedTransaction") != null && !jsonObj.get("rewardedTransaction").isJsonNull()) { + ReceivedPaymentRelationshipsReceivePaymentTransaction.validateJsonElement(jsonObj.get("rewardedTransaction")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateRewardRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateRewardRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateRewardRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateRewardRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateRewardRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateRewardRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateRewardRelationships + * @throws IOException if the JSON string is invalid with respect to CreateRewardRelationships + */ + public static CreateRewardRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateRewardRelationships.class); + } + + /** + * Convert an instance of CreateRewardRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateSoleProprietorApplication.java b/src/main/java/org/openapitools/client/model/CreateSoleProprietorApplication.java new file mode 100644 index 00000000..87551c19 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateSoleProprietorApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateSoleProprietorApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateSoleProprietorApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateSoleProprietorApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "individualApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateSoleProprietorApplicationAttributes attributes; + + public CreateSoleProprietorApplication() { + } + + public CreateSoleProprietorApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateSoleProprietorApplication attributes(CreateSoleProprietorApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateSoleProprietorApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateSoleProprietorApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSoleProprietorApplication createSoleProprietorApplication = (CreateSoleProprietorApplication) o; + return Objects.equals(this.type, createSoleProprietorApplication.type) && + Objects.equals(this.attributes, createSoleProprietorApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSoleProprietorApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSoleProprietorApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSoleProprietorApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSoleProprietorApplication is not found in the empty JSON string", CreateSoleProprietorApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSoleProprietorApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSoleProprietorApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSoleProprietorApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateSoleProprietorApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSoleProprietorApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSoleProprietorApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSoleProprietorApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSoleProprietorApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSoleProprietorApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSoleProprietorApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSoleProprietorApplication + * @throws IOException if the JSON string is invalid with respect to CreateSoleProprietorApplication + */ + public static CreateSoleProprietorApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSoleProprietorApplication.class); + } + + /** + * Convert an instance of CreateSoleProprietorApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateSoleProprietorApplicationAttributes.java b/src/main/java/org/openapitools/client/model/CreateSoleProprietorApplicationAttributes.java new file mode 100644 index 00000000..97c3b450 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateSoleProprietorApplicationAttributes.java @@ -0,0 +1,1042 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.BusinessVertical; +import org.openapitools.client.model.CreatePowerOfAttorneyAgent; +import org.openapitools.client.model.DeviceFingerprint; +import org.openapitools.client.model.EvaluationParams; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Industry; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.SoleProprietorshipAnnualRevenue; +import org.openapitools.client.model.SoleProprietorshipNumberOfEmployees; +import org.openapitools.client.model.SourceOfIncome; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateSoleProprietorApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateSoleProprietorApplicationAttributes { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + public static final String SERIALIZED_NAME_SOLE_PROPRIETORSHIP = "soleProprietorship"; + @SerializedName(SERIALIZED_NAME_SOLE_PROPRIETORSHIP) + private Boolean soleProprietorship = false; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_DEVICE_FINGERPRINTS = "deviceFingerprints"; + @SerializedName(SERIALIZED_NAME_DEVICE_FINGERPRINTS) + private List deviceFingerprints; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public static final String SERIALIZED_NAME_POWER_OF_ATTORNEY_AGENT = "powerOfAttorneyAgent"; + @SerializedName(SERIALIZED_NAME_POWER_OF_ATTORNEY_AGENT) + private CreatePowerOfAttorneyAgent powerOfAttorneyAgent; + + public static final String SERIALIZED_NAME_INDUSTRY = "industry"; + @SerializedName(SERIALIZED_NAME_INDUSTRY) + private Industry industry; + + public static final String SERIALIZED_NAME_EVALUATION_PARAMS = "evaluationParams"; + @SerializedName(SERIALIZED_NAME_EVALUATION_PARAMS) + private EvaluationParams evaluationParams; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public static final String SERIALIZED_NAME_ANNUAL_REVENUE = "annualRevenue"; + @SerializedName(SERIALIZED_NAME_ANNUAL_REVENUE) + private SoleProprietorshipAnnualRevenue annualRevenue; + + public static final String SERIALIZED_NAME_NUMBER_OF_EMPLOYEES = "numberOfEmployees"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_EMPLOYEES) + private SoleProprietorshipNumberOfEmployees numberOfEmployees; + + public static final String SERIALIZED_NAME_BUSINESS_VERTICAL = "businessVertical"; + @SerializedName(SERIALIZED_NAME_BUSINESS_VERTICAL) + private BusinessVertical businessVertical; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; + + public CreateSoleProprietorApplicationAttributes() { + } + + public CreateSoleProprietorApplicationAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public CreateSoleProprietorApplicationAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public CreateSoleProprietorApplicationAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public CreateSoleProprietorApplicationAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public CreateSoleProprietorApplicationAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public CreateSoleProprietorApplicationAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public CreateSoleProprietorApplicationAttributes matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public CreateSoleProprietorApplicationAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public CreateSoleProprietorApplicationAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public CreateSoleProprietorApplicationAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public CreateSoleProprietorApplicationAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public CreateSoleProprietorApplicationAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public CreateSoleProprietorApplicationAttributes soleProprietorship(Boolean soleProprietorship) { + + this.soleProprietorship = soleProprietorship; + return this; + } + + /** + * Get soleProprietorship + * @return soleProprietorship + **/ + @javax.annotation.Nullable + public Boolean getSoleProprietorship() { + return soleProprietorship; + } + + + public void setSoleProprietorship(Boolean soleProprietorship) { + this.soleProprietorship = soleProprietorship; + } + + + public CreateSoleProprietorApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateSoleProprietorApplicationAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateSoleProprietorApplicationAttributes deviceFingerprints(List deviceFingerprints) { + + this.deviceFingerprints = deviceFingerprints; + return this; + } + + public CreateSoleProprietorApplicationAttributes addDeviceFingerprintsItem(DeviceFingerprint deviceFingerprintsItem) { + if (this.deviceFingerprints == null) { + this.deviceFingerprints = new ArrayList<>(); + } + this.deviceFingerprints.add(deviceFingerprintsItem); + return this; + } + + /** + * Get deviceFingerprints + * @return deviceFingerprints + **/ + @javax.annotation.Nullable + public List getDeviceFingerprints() { + return deviceFingerprints; + } + + + public void setDeviceFingerprints(List deviceFingerprints) { + this.deviceFingerprints = deviceFingerprints; + } + + + public CreateSoleProprietorApplicationAttributes jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + public CreateSoleProprietorApplicationAttributes powerOfAttorneyAgent(CreatePowerOfAttorneyAgent powerOfAttorneyAgent) { + + this.powerOfAttorneyAgent = powerOfAttorneyAgent; + return this; + } + + /** + * Get powerOfAttorneyAgent + * @return powerOfAttorneyAgent + **/ + @javax.annotation.Nullable + public CreatePowerOfAttorneyAgent getPowerOfAttorneyAgent() { + return powerOfAttorneyAgent; + } + + + public void setPowerOfAttorneyAgent(CreatePowerOfAttorneyAgent powerOfAttorneyAgent) { + this.powerOfAttorneyAgent = powerOfAttorneyAgent; + } + + + public CreateSoleProprietorApplicationAttributes industry(Industry industry) { + + this.industry = industry; + return this; + } + + /** + * Get industry + * @return industry + **/ + @javax.annotation.Nullable + public Industry getIndustry() { + return industry; + } + + + public void setIndustry(Industry industry) { + this.industry = industry; + } + + + public CreateSoleProprietorApplicationAttributes evaluationParams(EvaluationParams evaluationParams) { + + this.evaluationParams = evaluationParams; + return this; + } + + /** + * Get evaluationParams + * @return evaluationParams + **/ + @javax.annotation.Nullable + public EvaluationParams getEvaluationParams() { + return evaluationParams; + } + + + public void setEvaluationParams(EvaluationParams evaluationParams) { + this.evaluationParams = evaluationParams; + } + + + public CreateSoleProprietorApplicationAttributes occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public CreateSoleProprietorApplicationAttributes annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public CreateSoleProprietorApplicationAttributes sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + public CreateSoleProprietorApplicationAttributes annualRevenue(SoleProprietorshipAnnualRevenue annualRevenue) { + + this.annualRevenue = annualRevenue; + return this; + } + + /** + * Get annualRevenue + * @return annualRevenue + **/ + @javax.annotation.Nullable + public SoleProprietorshipAnnualRevenue getAnnualRevenue() { + return annualRevenue; + } + + + public void setAnnualRevenue(SoleProprietorshipAnnualRevenue annualRevenue) { + this.annualRevenue = annualRevenue; + } + + + public CreateSoleProprietorApplicationAttributes numberOfEmployees(SoleProprietorshipNumberOfEmployees numberOfEmployees) { + + this.numberOfEmployees = numberOfEmployees; + return this; + } + + /** + * Get numberOfEmployees + * @return numberOfEmployees + **/ + @javax.annotation.Nullable + public SoleProprietorshipNumberOfEmployees getNumberOfEmployees() { + return numberOfEmployees; + } + + + public void setNumberOfEmployees(SoleProprietorshipNumberOfEmployees numberOfEmployees) { + this.numberOfEmployees = numberOfEmployees; + } + + + public CreateSoleProprietorApplicationAttributes businessVertical(BusinessVertical businessVertical) { + + this.businessVertical = businessVertical; + return this; + } + + /** + * Get businessVertical + * @return businessVertical + **/ + @javax.annotation.Nullable + public BusinessVertical getBusinessVertical() { + return businessVertical; + } + + + public void setBusinessVertical(BusinessVertical businessVertical) { + this.businessVertical = businessVertical; + } + + + public CreateSoleProprietorApplicationAttributes website(String website) { + + this.website = website; + return this; + } + + /** + * Get website + * @return website + **/ + @javax.annotation.Nullable + public String getWebsite() { + return website; + } + + + public void setWebsite(String website) { + this.website = website; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSoleProprietorApplicationAttributes createSoleProprietorApplicationAttributes = (CreateSoleProprietorApplicationAttributes) o; + return Objects.equals(this.fullName, createSoleProprietorApplicationAttributes.fullName) && + Objects.equals(this.email, createSoleProprietorApplicationAttributes.email) && + Objects.equals(this.phone, createSoleProprietorApplicationAttributes.phone) && + Objects.equals(this.ssn, createSoleProprietorApplicationAttributes.ssn) && + Objects.equals(this.passport, createSoleProprietorApplicationAttributes.passport) && + Objects.equals(this.nationality, createSoleProprietorApplicationAttributes.nationality) && + Objects.equals(this.matriculaConsular, createSoleProprietorApplicationAttributes.matriculaConsular) && + Objects.equals(this.address, createSoleProprietorApplicationAttributes.address) && + Objects.equals(this.dateOfBirth, createSoleProprietorApplicationAttributes.dateOfBirth) && + Objects.equals(this.dba, createSoleProprietorApplicationAttributes.dba) && + Objects.equals(this.ein, createSoleProprietorApplicationAttributes.ein) && + Objects.equals(this.ip, createSoleProprietorApplicationAttributes.ip) && + Objects.equals(this.soleProprietorship, createSoleProprietorApplicationAttributes.soleProprietorship) && + Objects.equals(this.tags, createSoleProprietorApplicationAttributes.tags) && + Objects.equals(this.idempotencyKey, createSoleProprietorApplicationAttributes.idempotencyKey) && + Objects.equals(this.deviceFingerprints, createSoleProprietorApplicationAttributes.deviceFingerprints) && + Objects.equals(this.jwtSubject, createSoleProprietorApplicationAttributes.jwtSubject) && + Objects.equals(this.powerOfAttorneyAgent, createSoleProprietorApplicationAttributes.powerOfAttorneyAgent) && + Objects.equals(this.industry, createSoleProprietorApplicationAttributes.industry) && + Objects.equals(this.evaluationParams, createSoleProprietorApplicationAttributes.evaluationParams) && + Objects.equals(this.occupation, createSoleProprietorApplicationAttributes.occupation) && + Objects.equals(this.annualIncome, createSoleProprietorApplicationAttributes.annualIncome) && + Objects.equals(this.sourceOfIncome, createSoleProprietorApplicationAttributes.sourceOfIncome) && + Objects.equals(this.annualRevenue, createSoleProprietorApplicationAttributes.annualRevenue) && + Objects.equals(this.numberOfEmployees, createSoleProprietorApplicationAttributes.numberOfEmployees) && + Objects.equals(this.businessVertical, createSoleProprietorApplicationAttributes.businessVertical) && + Objects.equals(this.website, createSoleProprietorApplicationAttributes.website); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, dba, ein, ip, soleProprietorship, tags, idempotencyKey, deviceFingerprints, jwtSubject, powerOfAttorneyAgent, industry, evaluationParams, occupation, annualIncome, sourceOfIncome, annualRevenue, numberOfEmployees, businessVertical, website); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSoleProprietorApplicationAttributes {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" soleProprietorship: ").append(toIndentedString(soleProprietorship)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" deviceFingerprints: ").append(toIndentedString(deviceFingerprints)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append(" powerOfAttorneyAgent: ").append(toIndentedString(powerOfAttorneyAgent)).append("\n"); + sb.append(" industry: ").append(toIndentedString(industry)).append("\n"); + sb.append(" evaluationParams: ").append(toIndentedString(evaluationParams)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append(" annualRevenue: ").append(toIndentedString(annualRevenue)).append("\n"); + sb.append(" numberOfEmployees: ").append(toIndentedString(numberOfEmployees)).append("\n"); + sb.append(" businessVertical: ").append(toIndentedString(businessVertical)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("ip"); + openapiFields.add("soleProprietorship"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + openapiFields.add("deviceFingerprints"); + openapiFields.add("jwtSubject"); + openapiFields.add("powerOfAttorneyAgent"); + openapiFields.add("industry"); + openapiFields.add("evaluationParams"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + openapiFields.add("annualRevenue"); + openapiFields.add("numberOfEmployees"); + openapiFields.add("businessVertical"); + openapiFields.add("website"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSoleProprietorApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSoleProprietorApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSoleProprietorApplicationAttributes is not found in the empty JSON string", CreateSoleProprietorApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSoleProprietorApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSoleProprietorApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSoleProprietorApplicationAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if (jsonObj.get("deviceFingerprints") != null && !jsonObj.get("deviceFingerprints").isJsonNull()) { + JsonArray jsonArraydeviceFingerprints = jsonObj.getAsJsonArray("deviceFingerprints"); + if (jsonArraydeviceFingerprints != null) { + // ensure the json data is an array + if (!jsonObj.get("deviceFingerprints").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `deviceFingerprints` to be an array in the JSON string but got `%s`", jsonObj.get("deviceFingerprints").toString())); + } + + // validate the optional field `deviceFingerprints` (array) + for (int i = 0; i < jsonArraydeviceFingerprints.size(); i++) { + DeviceFingerprint.validateJsonElement(jsonArraydeviceFingerprints.get(i)); + }; + } + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + // validate the optional field `powerOfAttorneyAgent` + if (jsonObj.get("powerOfAttorneyAgent") != null && !jsonObj.get("powerOfAttorneyAgent").isJsonNull()) { + CreatePowerOfAttorneyAgent.validateJsonElement(jsonObj.get("powerOfAttorneyAgent")); + } + // validate the optional field `evaluationParams` + if (jsonObj.get("evaluationParams") != null && !jsonObj.get("evaluationParams").isJsonNull()) { + EvaluationParams.validateJsonElement(jsonObj.get("evaluationParams")); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `website` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSoleProprietorApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSoleProprietorApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSoleProprietorApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSoleProprietorApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSoleProprietorApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSoleProprietorApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSoleProprietorApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to CreateSoleProprietorApplicationAttributes + */ + public static CreateSoleProprietorApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSoleProprietorApplicationAttributes.class); + } + + /** + * Convert an instance of CreateSoleProprietorApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateStopPayment.java b/src/main/java/org/openapitools/client/model/CreateStopPayment.java new file mode 100644 index 00000000..c67597dd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateStopPayment.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.StopPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateStopPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateStopPayment { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private StopPayment data; + + public CreateStopPayment() { + } + + public CreateStopPayment data(StopPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public StopPayment getData() { + return data; + } + + + public void setData(StopPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateStopPayment createStopPayment = (CreateStopPayment) o; + return Objects.equals(this.data, createStopPayment.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateStopPayment {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateStopPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateStopPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateStopPayment is not found in the empty JSON string", CreateStopPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateStopPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateStopPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateStopPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + StopPayment.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateStopPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateStopPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateStopPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateStopPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateStopPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateStopPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateStopPayment + * @throws IOException if the JSON string is invalid with respect to CreateStopPayment + */ + public static CreateStopPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateStopPayment.class); + } + + /** + * Convert an instance of CreateStopPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateTrustApplication.java b/src/main/java/org/openapitools/client/model/CreateTrustApplication.java new file mode 100644 index 00000000..6027270c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateTrustApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateTrustApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateTrustApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateTrustApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "trustApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateTrustApplicationAttributes attributes; + + public CreateTrustApplication() { + } + + public CreateTrustApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateTrustApplication attributes(CreateTrustApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateTrustApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateTrustApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTrustApplication createTrustApplication = (CreateTrustApplication) o; + return Objects.equals(this.type, createTrustApplication.type) && + Objects.equals(this.attributes, createTrustApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTrustApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTrustApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTrustApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTrustApplication is not found in the empty JSON string", CreateTrustApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTrustApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTrustApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTrustApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateTrustApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTrustApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTrustApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTrustApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTrustApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTrustApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTrustApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTrustApplication + * @throws IOException if the JSON string is invalid with respect to CreateTrustApplication + */ + public static CreateTrustApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTrustApplication.class); + } + + /** + * Convert an instance of CreateTrustApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateTrustApplicationAttributes.java b/src/main/java/org/openapitools/client/model/CreateTrustApplicationAttributes.java new file mode 100644 index 00000000..eb3794bd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateTrustApplicationAttributes.java @@ -0,0 +1,747 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Beneficiary; +import org.openapitools.client.model.DeviceFingerprint; +import org.openapitools.client.model.Grantor; +import org.openapitools.client.model.TrustContact; +import org.openapitools.client.model.Trustee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateTrustApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateTrustApplicationAttributes { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + /** + * Gets or Sets revocability + */ + @JsonAdapter(RevocabilityEnum.Adapter.class) + public enum RevocabilityEnum { + REVOCABLE("Revocable"), + + IRREVOCABLE("Irrevocable"); + + private String value; + + RevocabilityEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RevocabilityEnum fromValue(String value) { + for (RevocabilityEnum b : RevocabilityEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RevocabilityEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RevocabilityEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RevocabilityEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REVOCABILITY = "revocability"; + @SerializedName(SERIALIZED_NAME_REVOCABILITY) + private RevocabilityEnum revocability; + + /** + * Gets or Sets sourceOfFunds + */ + @JsonAdapter(SourceOfFundsEnum.Adapter.class) + public enum SourceOfFundsEnum { + INHERITANCE("Inheritance"), + + SALARY("Salary"), + + SAVINGS("Savings"), + + INVESTMENTRETURNS("InvestmentReturns"), + + GIFTS("Gifts"); + + private String value; + + SourceOfFundsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceOfFundsEnum fromValue(String value) { + for (SourceOfFundsEnum b : SourceOfFundsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SourceOfFundsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceOfFundsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceOfFundsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SOURCE_OF_FUNDS = "sourceOfFunds"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_FUNDS) + private SourceOfFundsEnum sourceOfFunds; + + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @SerializedName(SERIALIZED_NAME_TAX_ID) + private String taxId; + + public static final String SERIALIZED_NAME_GRANTOR = "grantor"; + @SerializedName(SERIALIZED_NAME_GRANTOR) + private Grantor grantor; + + public static final String SERIALIZED_NAME_TRUSTEES = "trustees"; + @SerializedName(SERIALIZED_NAME_TRUSTEES) + private List trustees = new ArrayList<>(); + + public static final String SERIALIZED_NAME_BENEFICIARIES = "beneficiaries"; + @SerializedName(SERIALIZED_NAME_BENEFICIARIES) + private List beneficiaries = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private TrustContact contact; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_DEVICE_FINGERPRINTS = "deviceFingerprints"; + @SerializedName(SERIALIZED_NAME_DEVICE_FINGERPRINTS) + private List deviceFingerprints; + + public CreateTrustApplicationAttributes() { + } + + public CreateTrustApplicationAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CreateTrustApplicationAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nonnull + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public CreateTrustApplicationAttributes revocability(RevocabilityEnum revocability) { + + this.revocability = revocability; + return this; + } + + /** + * Get revocability + * @return revocability + **/ + @javax.annotation.Nonnull + public RevocabilityEnum getRevocability() { + return revocability; + } + + + public void setRevocability(RevocabilityEnum revocability) { + this.revocability = revocability; + } + + + public CreateTrustApplicationAttributes sourceOfFunds(SourceOfFundsEnum sourceOfFunds) { + + this.sourceOfFunds = sourceOfFunds; + return this; + } + + /** + * Get sourceOfFunds + * @return sourceOfFunds + **/ + @javax.annotation.Nonnull + public SourceOfFundsEnum getSourceOfFunds() { + return sourceOfFunds; + } + + + public void setSourceOfFunds(SourceOfFundsEnum sourceOfFunds) { + this.sourceOfFunds = sourceOfFunds; + } + + + public CreateTrustApplicationAttributes taxId(String taxId) { + + this.taxId = taxId; + return this; + } + + /** + * Get taxId + * @return taxId + **/ + @javax.annotation.Nonnull + public String getTaxId() { + return taxId; + } + + + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + + public CreateTrustApplicationAttributes grantor(Grantor grantor) { + + this.grantor = grantor; + return this; + } + + /** + * Get grantor + * @return grantor + **/ + @javax.annotation.Nonnull + public Grantor getGrantor() { + return grantor; + } + + + public void setGrantor(Grantor grantor) { + this.grantor = grantor; + } + + + public CreateTrustApplicationAttributes trustees(List trustees) { + + this.trustees = trustees; + return this; + } + + public CreateTrustApplicationAttributes addTrusteesItem(Trustee trusteesItem) { + if (this.trustees == null) { + this.trustees = new ArrayList<>(); + } + this.trustees.add(trusteesItem); + return this; + } + + /** + * Get trustees + * @return trustees + **/ + @javax.annotation.Nonnull + public List getTrustees() { + return trustees; + } + + + public void setTrustees(List trustees) { + this.trustees = trustees; + } + + + public CreateTrustApplicationAttributes beneficiaries(List beneficiaries) { + + this.beneficiaries = beneficiaries; + return this; + } + + public CreateTrustApplicationAttributes addBeneficiariesItem(Beneficiary beneficiariesItem) { + if (this.beneficiaries == null) { + this.beneficiaries = new ArrayList<>(); + } + this.beneficiaries.add(beneficiariesItem); + return this; + } + + /** + * Get beneficiaries + * @return beneficiaries + **/ + @javax.annotation.Nonnull + public List getBeneficiaries() { + return beneficiaries; + } + + + public void setBeneficiaries(List beneficiaries) { + this.beneficiaries = beneficiaries; + } + + + public CreateTrustApplicationAttributes contact(TrustContact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nonnull + public TrustContact getContact() { + return contact; + } + + + public void setContact(TrustContact contact) { + this.contact = contact; + } + + + public CreateTrustApplicationAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public CreateTrustApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreateTrustApplicationAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateTrustApplicationAttributes deviceFingerprints(List deviceFingerprints) { + + this.deviceFingerprints = deviceFingerprints; + return this; + } + + public CreateTrustApplicationAttributes addDeviceFingerprintsItem(DeviceFingerprint deviceFingerprintsItem) { + if (this.deviceFingerprints == null) { + this.deviceFingerprints = new ArrayList<>(); + } + this.deviceFingerprints.add(deviceFingerprintsItem); + return this; + } + + /** + * Get deviceFingerprints + * @return deviceFingerprints + **/ + @javax.annotation.Nullable + public List getDeviceFingerprints() { + return deviceFingerprints; + } + + + public void setDeviceFingerprints(List deviceFingerprints) { + this.deviceFingerprints = deviceFingerprints; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTrustApplicationAttributes createTrustApplicationAttributes = (CreateTrustApplicationAttributes) o; + return Objects.equals(this.name, createTrustApplicationAttributes.name) && + Objects.equals(this.stateOfIncorporation, createTrustApplicationAttributes.stateOfIncorporation) && + Objects.equals(this.revocability, createTrustApplicationAttributes.revocability) && + Objects.equals(this.sourceOfFunds, createTrustApplicationAttributes.sourceOfFunds) && + Objects.equals(this.taxId, createTrustApplicationAttributes.taxId) && + Objects.equals(this.grantor, createTrustApplicationAttributes.grantor) && + Objects.equals(this.trustees, createTrustApplicationAttributes.trustees) && + Objects.equals(this.beneficiaries, createTrustApplicationAttributes.beneficiaries) && + Objects.equals(this.contact, createTrustApplicationAttributes.contact) && + Objects.equals(this.ip, createTrustApplicationAttributes.ip) && + Objects.equals(this.tags, createTrustApplicationAttributes.tags) && + Objects.equals(this.idempotencyKey, createTrustApplicationAttributes.idempotencyKey) && + Objects.equals(this.deviceFingerprints, createTrustApplicationAttributes.deviceFingerprints); + } + + @Override + public int hashCode() { + return Objects.hash(name, stateOfIncorporation, revocability, sourceOfFunds, taxId, grantor, trustees, beneficiaries, contact, ip, tags, idempotencyKey, deviceFingerprints); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTrustApplicationAttributes {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" revocability: ").append(toIndentedString(revocability)).append("\n"); + sb.append(" sourceOfFunds: ").append(toIndentedString(sourceOfFunds)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append(" grantor: ").append(toIndentedString(grantor)).append("\n"); + sb.append(" trustees: ").append(toIndentedString(trustees)).append("\n"); + sb.append(" beneficiaries: ").append(toIndentedString(beneficiaries)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" deviceFingerprints: ").append(toIndentedString(deviceFingerprints)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("revocability"); + openapiFields.add("sourceOfFunds"); + openapiFields.add("taxId"); + openapiFields.add("grantor"); + openapiFields.add("trustees"); + openapiFields.add("beneficiaries"); + openapiFields.add("contact"); + openapiFields.add("ip"); + openapiFields.add("tags"); + openapiFields.add("idempotencyKey"); + openapiFields.add("deviceFingerprints"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("stateOfIncorporation"); + openapiRequiredFields.add("revocability"); + openapiRequiredFields.add("sourceOfFunds"); + openapiRequiredFields.add("taxId"); + openapiRequiredFields.add("grantor"); + openapiRequiredFields.add("trustees"); + openapiRequiredFields.add("beneficiaries"); + openapiRequiredFields.add("contact"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTrustApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTrustApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTrustApplicationAttributes is not found in the empty JSON string", CreateTrustApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTrustApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTrustApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTrustApplicationAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + if (!jsonObj.get("revocability").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `revocability` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revocability").toString())); + } + if (!jsonObj.get("sourceOfFunds").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceOfFunds` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceOfFunds").toString())); + } + if (!jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + // validate the required field `grantor` + Grantor.validateJsonElement(jsonObj.get("grantor")); + // ensure the json data is an array + if (!jsonObj.get("trustees").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `trustees` to be an array in the JSON string but got `%s`", jsonObj.get("trustees").toString())); + } + + JsonArray jsonArraytrustees = jsonObj.getAsJsonArray("trustees"); + // validate the required field `trustees` (array) + for (int i = 0; i < jsonArraytrustees.size(); i++) { + Trustee.validateJsonElement(jsonArraytrustees.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("beneficiaries").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficiaries` to be an array in the JSON string but got `%s`", jsonObj.get("beneficiaries").toString())); + } + + JsonArray jsonArraybeneficiaries = jsonObj.getAsJsonArray("beneficiaries"); + // validate the required field `beneficiaries` (array) + for (int i = 0; i < jsonArraybeneficiaries.size(); i++) { + Beneficiary.validateJsonElement(jsonArraybeneficiaries.get(i)); + }; + // validate the required field `contact` + TrustContact.validateJsonElement(jsonObj.get("contact")); + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + if (jsonObj.get("deviceFingerprints") != null && !jsonObj.get("deviceFingerprints").isJsonNull()) { + JsonArray jsonArraydeviceFingerprints = jsonObj.getAsJsonArray("deviceFingerprints"); + if (jsonArraydeviceFingerprints != null) { + // ensure the json data is an array + if (!jsonObj.get("deviceFingerprints").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `deviceFingerprints` to be an array in the JSON string but got `%s`", jsonObj.get("deviceFingerprints").toString())); + } + + // validate the optional field `deviceFingerprints` (array) + for (int i = 0; i < jsonArraydeviceFingerprints.size(); i++) { + DeviceFingerprint.validateJsonElement(jsonArraydeviceFingerprints.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTrustApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTrustApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTrustApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTrustApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTrustApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTrustApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTrustApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to CreateTrustApplicationAttributes + */ + public static CreateTrustApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTrustApplicationAttributes.class); + } + + /** + * Convert an instance of CreateTrustApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateWebhook.java b/src/main/java/org/openapitools/client/model/CreateWebhook.java new file mode 100644 index 00000000..97fadd17 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateWebhook.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateWebhookData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateWebhook + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateWebhook { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateWebhookData data; + + public CreateWebhook() { + } + + public CreateWebhook data(CreateWebhookData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateWebhookData getData() { + return data; + } + + + public void setData(CreateWebhookData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWebhook createWebhook = (CreateWebhook) o; + return Objects.equals(this.data, createWebhook.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWebhook {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebhook + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebhook.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWebhook is not found in the empty JSON string", CreateWebhook.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWebhook.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWebhook` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateWebhookData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebhook.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebhook' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebhook.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebhook value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWebhook read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebhook given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebhook + * @throws IOException if the JSON string is invalid with respect to CreateWebhook + */ + public static CreateWebhook fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebhook.class); + } + + /** + * Convert an instance of CreateWebhook to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateWebhookData.java b/src/main/java/org/openapitools/client/model/CreateWebhookData.java new file mode 100644 index 00000000..aa7468af --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateWebhookData.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateWebhookDataAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateWebhookData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateWebhookData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "webhook"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateWebhookDataAttributes attributes; + + public CreateWebhookData() { + } + + public CreateWebhookData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateWebhookData attributes(CreateWebhookDataAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public CreateWebhookDataAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateWebhookDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWebhookData createWebhookData = (CreateWebhookData) o; + return Objects.equals(this.type, createWebhookData.type) && + Objects.equals(this.attributes, createWebhookData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWebhookData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebhookData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebhookData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWebhookData is not found in the empty JSON string", CreateWebhookData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWebhookData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWebhookData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + CreateWebhookDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebhookData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebhookData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebhookData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebhookData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWebhookData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebhookData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebhookData + * @throws IOException if the JSON string is invalid with respect to CreateWebhookData + */ + public static CreateWebhookData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebhookData.class); + } + + /** + * Convert an instance of CreateWebhookData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateWebhookDataAttributes.java b/src/main/java/org/openapitools/client/model/CreateWebhookDataAttributes.java new file mode 100644 index 00000000..1b38597f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateWebhookDataAttributes.java @@ -0,0 +1,497 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateWebhookDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateWebhookDataAttributes { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + JSON("Json"), + + JSONAPI("JsonAPI"); + + private String value; + + ContentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ContentTypeEnum fromValue(String value) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ContentTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CONTENT_TYPE = "contentType"; + @SerializedName(SERIALIZED_NAME_CONTENT_TYPE) + private ContentTypeEnum contentType; + + public static final String SERIALIZED_NAME_DELIVERY_MODE = "deliveryMode"; + @SerializedName(SERIALIZED_NAME_DELIVERY_MODE) + private String deliveryMode; + + public static final String SERIALIZED_NAME_INCLUDE_RESOURCES = "includeResources"; + @SerializedName(SERIALIZED_NAME_INCLUDE_RESOURCES) + private Boolean includeResources; + + /** + * Gets or Sets subscriptionType + */ + @JsonAdapter(SubscriptionTypeEnum.Adapter.class) + public enum SubscriptionTypeEnum { + ALL("All"), + + ONLYAUTHORIZATIONREQUEST("OnlyAuthorizationRequest"); + + private String value; + + SubscriptionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SubscriptionTypeEnum fromValue(String value) { + for (SubscriptionTypeEnum b : SubscriptionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SubscriptionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SubscriptionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SubscriptionTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SUBSCRIPTION_TYPE = "subscriptionType"; + @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_TYPE) + private SubscriptionTypeEnum subscriptionType; + + public CreateWebhookDataAttributes() { + } + + public CreateWebhookDataAttributes label(String label) { + + this.label = label; + return this; + } + + /** + * Get label + * @return label + **/ + @javax.annotation.Nonnull + public String getLabel() { + return label; + } + + + public void setLabel(String label) { + this.label = label; + } + + + public CreateWebhookDataAttributes url(String url) { + + this.url = url; + return this; + } + + /** + * Get url + * @return url + **/ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + this.url = url; + } + + + public CreateWebhookDataAttributes token(String token) { + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nonnull + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + public CreateWebhookDataAttributes contentType(ContentTypeEnum contentType) { + + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + **/ + @javax.annotation.Nonnull + public ContentTypeEnum getContentType() { + return contentType; + } + + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + + public CreateWebhookDataAttributes deliveryMode(String deliveryMode) { + + this.deliveryMode = deliveryMode; + return this; + } + + /** + * Get deliveryMode + * @return deliveryMode + **/ + @javax.annotation.Nonnull + public String getDeliveryMode() { + return deliveryMode; + } + + + public void setDeliveryMode(String deliveryMode) { + this.deliveryMode = deliveryMode; + } + + + public CreateWebhookDataAttributes includeResources(Boolean includeResources) { + + this.includeResources = includeResources; + return this; + } + + /** + * Get includeResources + * @return includeResources + **/ + @javax.annotation.Nullable + public Boolean getIncludeResources() { + return includeResources; + } + + + public void setIncludeResources(Boolean includeResources) { + this.includeResources = includeResources; + } + + + public CreateWebhookDataAttributes subscriptionType(SubscriptionTypeEnum subscriptionType) { + + this.subscriptionType = subscriptionType; + return this; + } + + /** + * Get subscriptionType + * @return subscriptionType + **/ + @javax.annotation.Nullable + public SubscriptionTypeEnum getSubscriptionType() { + return subscriptionType; + } + + + public void setSubscriptionType(SubscriptionTypeEnum subscriptionType) { + this.subscriptionType = subscriptionType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWebhookDataAttributes createWebhookDataAttributes = (CreateWebhookDataAttributes) o; + return Objects.equals(this.label, createWebhookDataAttributes.label) && + Objects.equals(this.url, createWebhookDataAttributes.url) && + Objects.equals(this.token, createWebhookDataAttributes.token) && + Objects.equals(this.contentType, createWebhookDataAttributes.contentType) && + Objects.equals(this.deliveryMode, createWebhookDataAttributes.deliveryMode) && + Objects.equals(this.includeResources, createWebhookDataAttributes.includeResources) && + Objects.equals(this.subscriptionType, createWebhookDataAttributes.subscriptionType); + } + + @Override + public int hashCode() { + return Objects.hash(label, url, token, contentType, deliveryMode, includeResources, subscriptionType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWebhookDataAttributes {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" deliveryMode: ").append(toIndentedString(deliveryMode)).append("\n"); + sb.append(" includeResources: ").append(toIndentedString(includeResources)).append("\n"); + sb.append(" subscriptionType: ").append(toIndentedString(subscriptionType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("url"); + openapiFields.add("token"); + openapiFields.add("contentType"); + openapiFields.add("deliveryMode"); + openapiFields.add("includeResources"); + openapiFields.add("subscriptionType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("label"); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("token"); + openapiRequiredFields.add("contentType"); + openapiRequiredFields.add("deliveryMode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebhookDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebhookDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWebhookDataAttributes is not found in the empty JSON string", CreateWebhookDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWebhookDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWebhookDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWebhookDataAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + if (!jsonObj.get("contentType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentType").toString())); + } + if (!jsonObj.get("deliveryMode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deliveryMode").toString())); + } + if ((jsonObj.get("subscriptionType") != null && !jsonObj.get("subscriptionType").isJsonNull()) && !jsonObj.get("subscriptionType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `subscriptionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subscriptionType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebhookDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebhookDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebhookDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebhookDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWebhookDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebhookDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebhookDataAttributes + * @throws IOException if the JSON string is invalid with respect to CreateWebhookDataAttributes + */ + public static CreateWebhookDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebhookDataAttributes.class); + } + + /** + * Convert an instance of CreateWebhookDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateWirePayment.java b/src/main/java/org/openapitools/client/model/CreateWirePayment.java new file mode 100644 index 00000000..30480c02 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateWirePayment.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateAchPaymentRelationships; +import org.openapitools.client.model.CreateWirePaymentAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateWirePayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateWirePayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "wirePayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreateWirePaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreateAchPaymentRelationships relationships; + + public CreateWirePayment() { + } + + public CreateWirePayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateWirePayment attributes(CreateWirePaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreateWirePaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreateWirePaymentAttributes attributes) { + this.attributes = attributes; + } + + + public CreateWirePayment relationships(CreateAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreateAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreateAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWirePayment createWirePayment = (CreateWirePayment) o; + return Objects.equals(this.type, createWirePayment.type) && + Objects.equals(this.attributes, createWirePayment.attributes) && + Objects.equals(this.relationships, createWirePayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWirePayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWirePayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWirePayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWirePayment is not found in the empty JSON string", CreateWirePayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWirePayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWirePayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWirePayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CreateWirePaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + CreateAchPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWirePayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWirePayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWirePayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWirePayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWirePayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWirePayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWirePayment + * @throws IOException if the JSON string is invalid with respect to CreateWirePayment + */ + public static CreateWirePayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWirePayment.class); + } + + /** + * Convert an instance of CreateWirePayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateWirePaymentAttributes.java b/src/main/java/org/openapitools/client/model/CreateWirePaymentAttributes.java new file mode 100644 index 00000000..3f39b7ba --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreateWirePaymentAttributes.java @@ -0,0 +1,412 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.WireCounterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreateWirePaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateWirePaymentAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private WireCounterparty counterparty; + + public static final String SERIALIZED_NAME_IDEMPOTENCY_KEY = "idempotencyKey"; + @SerializedName(SERIALIZED_NAME_IDEMPOTENCY_KEY) + private String idempotencyKey; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public CreateWirePaymentAttributes() { + } + + public CreateWirePaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public CreateWirePaymentAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public CreateWirePaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateWirePaymentAttributes counterparty(WireCounterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public WireCounterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(WireCounterparty counterparty) { + this.counterparty = counterparty; + } + + + public CreateWirePaymentAttributes idempotencyKey(String idempotencyKey) { + + this.idempotencyKey = idempotencyKey; + return this; + } + + /** + * Get idempotencyKey + * @return idempotencyKey + **/ + @javax.annotation.Nullable + public String getIdempotencyKey() { + return idempotencyKey; + } + + + public void setIdempotencyKey(String idempotencyKey) { + this.idempotencyKey = idempotencyKey; + } + + + public CreateWirePaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWirePaymentAttributes createWirePaymentAttributes = (CreateWirePaymentAttributes) o; + return Objects.equals(this.amount, createWirePaymentAttributes.amount) && + Objects.equals(this.direction, createWirePaymentAttributes.direction) && + Objects.equals(this.description, createWirePaymentAttributes.description) && + Objects.equals(this.counterparty, createWirePaymentAttributes.counterparty) && + Objects.equals(this.idempotencyKey, createWirePaymentAttributes.idempotencyKey) && + Objects.equals(this.tags, createWirePaymentAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, direction, description, counterparty, idempotencyKey, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWirePaymentAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("description"); + openapiFields.add("counterparty"); + openapiFields.add("idempotencyKey"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWirePaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWirePaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateWirePaymentAttributes is not found in the empty JSON string", CreateWirePaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateWirePaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateWirePaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWirePaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull()) && !jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `counterparty` + WireCounterparty.validateJsonElement(jsonObj.get("counterparty")); + if ((jsonObj.get("idempotencyKey") != null && !jsonObj.get("idempotencyKey").isJsonNull()) && !jsonObj.get("idempotencyKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idempotencyKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idempotencyKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWirePaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWirePaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWirePaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWirePaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateWirePaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWirePaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWirePaymentAttributes + * @throws IOException if the JSON string is invalid with respect to CreateWirePaymentAttributes + */ + public static CreateWirePaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWirePaymentAttributes.class); + } + + /** + * Convert an instance of CreateWirePaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreditAccount.java b/src/main/java/org/openapitools/client/model/CreditAccount.java new file mode 100644 index 00000000..1bcb2214 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreditAccount.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Account; +import org.openapitools.client.model.CreditAccountAllOfAttributes; +import org.openapitools.client.model.CreditAccountRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreditAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreditAccount extends Account { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreditAccountAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CreditAccountRelationships relationships; + + public CreditAccount() { + this.type = this.getClass().getSimpleName(); + } + + public CreditAccount attributes(CreditAccountAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreditAccountAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreditAccountAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CreditAccount relationships(CreditAccountRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CreditAccountRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CreditAccountRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreditAccount creditAccount = (CreditAccount) o; + return Objects.equals(this.attributes, creditAccount.attributes) && + Objects.equals(this.relationships, creditAccount.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreditAccount {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreditAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreditAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreditAccount is not found in the empty JSON string", CreditAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreditAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreditAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreditAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreditAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreditAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreditAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreditAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreditAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreditAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreditAccount + * @throws IOException if the JSON string is invalid with respect to CreditAccount + */ + public static CreditAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreditAccount.class); + } + + /** + * Convert an instance of CreditAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreditAccountAllOfAttributes.java b/src/main/java/org/openapitools/client/model/CreditAccountAllOfAttributes.java new file mode 100644 index 00000000..ea7ea008 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreditAccountAllOfAttributes.java @@ -0,0 +1,797 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreditAccountAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreditAccountAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_CREDIT_TERMS = "creditTerms"; + @SerializedName(SERIALIZED_NAME_CREDIT_TERMS) + private String creditTerms; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency = "USD"; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_HOLD = "hold"; + @SerializedName(SERIALIZED_NAME_HOLD) + private Integer hold; + + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + private Integer available; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + OPEN("Open"), + + CLOSED("Closed"), + + FROZEN("Frozen"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + /** + * Gets or Sets closeReason + */ + @JsonAdapter(CloseReasonEnum.Adapter.class) + public enum CloseReasonEnum { + BYCUSTOMER("ByCustomer"), + + FRAUD("Fraud"), + + OVERDUE("Overdue"); + + private String value; + + CloseReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CloseReasonEnum fromValue(String value) { + for (CloseReasonEnum b : CloseReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CloseReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CloseReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CloseReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CLOSE_REASON = "closeReason"; + @SerializedName(SERIALIZED_NAME_CLOSE_REASON) + private CloseReasonEnum closeReason; + + /** + * Gets or Sets fraudReason + */ + @JsonAdapter(FraudReasonEnum.Adapter.class) + public enum FraudReasonEnum { + ACHACTIVITY("ACHActivity"), + + CARDACTIVITY("CardActivity"), + + CHECKACTIVITY("CheckActivity"), + + APPLICATIONHISTORY("ApplicationHistory"), + + ACCOUNTACTIVITY("AccountActivity"), + + CLIENTIDENTIFIED("ClientIdentified"), + + IDENTITYTHEFT("IdentityTheft"), + + LINKEDTOFRAUDULENTCUSTOMER("LinkedToFraudulentCustomer"); + + private String value; + + FraudReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FraudReasonEnum fromValue(String value) { + for (FraudReasonEnum b : FraudReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final FraudReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FraudReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FraudReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_FRAUD_REASON = "fraudReason"; + @SerializedName(SERIALIZED_NAME_FRAUD_REASON) + private FraudReasonEnum fraudReason; + + public static final String SERIALIZED_NAME_CLOSE_REASON_TEXT = "closeReasonText"; + @SerializedName(SERIALIZED_NAME_CLOSE_REASON_TEXT) + private String closeReasonText; + + public static final String SERIALIZED_NAME_FREEZE_REASON = "freezeReason"; + @SerializedName(SERIALIZED_NAME_FREEZE_REASON) + private String freezeReason; + + public static final String SERIALIZED_NAME_CREDIT_LIMIT = "creditLimit"; + @SerializedName(SERIALIZED_NAME_CREDIT_LIMIT) + private Integer creditLimit; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public CreditAccountAllOfAttributes() { + } + + public CreditAccountAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CreditAccountAllOfAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CreditAccountAllOfAttributes creditTerms(String creditTerms) { + + this.creditTerms = creditTerms; + return this; + } + + /** + * Get creditTerms + * @return creditTerms + **/ + @javax.annotation.Nonnull + public String getCreditTerms() { + return creditTerms; + } + + + public void setCreditTerms(String creditTerms) { + this.creditTerms = creditTerms; + } + + + public CreditAccountAllOfAttributes currency(String currency) { + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + this.currency = currency; + } + + + public CreditAccountAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public CreditAccountAllOfAttributes hold(Integer hold) { + + this.hold = hold; + return this; + } + + /** + * Get hold + * @return hold + **/ + @javax.annotation.Nonnull + public Integer getHold() { + return hold; + } + + + public void setHold(Integer hold) { + this.hold = hold; + } + + + public CreditAccountAllOfAttributes available(Integer available) { + + this.available = available; + return this; + } + + /** + * Get available + * @return available + **/ + @javax.annotation.Nonnull + public Integer getAvailable() { + return available; + } + + + public void setAvailable(Integer available) { + this.available = available; + } + + + public CreditAccountAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nonnull + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public CreditAccountAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public CreditAccountAllOfAttributes closeReason(CloseReasonEnum closeReason) { + + this.closeReason = closeReason; + return this; + } + + /** + * Get closeReason + * @return closeReason + **/ + @javax.annotation.Nullable + public CloseReasonEnum getCloseReason() { + return closeReason; + } + + + public void setCloseReason(CloseReasonEnum closeReason) { + this.closeReason = closeReason; + } + + + public CreditAccountAllOfAttributes fraudReason(FraudReasonEnum fraudReason) { + + this.fraudReason = fraudReason; + return this; + } + + /** + * Get fraudReason + * @return fraudReason + **/ + @javax.annotation.Nullable + public FraudReasonEnum getFraudReason() { + return fraudReason; + } + + + public void setFraudReason(FraudReasonEnum fraudReason) { + this.fraudReason = fraudReason; + } + + + public CreditAccountAllOfAttributes closeReasonText(String closeReasonText) { + + this.closeReasonText = closeReasonText; + return this; + } + + /** + * Get closeReasonText + * @return closeReasonText + **/ + @javax.annotation.Nullable + public String getCloseReasonText() { + return closeReasonText; + } + + + public void setCloseReasonText(String closeReasonText) { + this.closeReasonText = closeReasonText; + } + + + public CreditAccountAllOfAttributes freezeReason(String freezeReason) { + + this.freezeReason = freezeReason; + return this; + } + + /** + * Get freezeReason + * @return freezeReason + **/ + @javax.annotation.Nullable + public String getFreezeReason() { + return freezeReason; + } + + + public void setFreezeReason(String freezeReason) { + this.freezeReason = freezeReason; + } + + + public CreditAccountAllOfAttributes creditLimit(Integer creditLimit) { + + this.creditLimit = creditLimit; + return this; + } + + /** + * Get creditLimit + * minimum: 0 + * @return creditLimit + **/ + @javax.annotation.Nonnull + public Integer getCreditLimit() { + return creditLimit; + } + + + public void setCreditLimit(Integer creditLimit) { + this.creditLimit = creditLimit; + } + + + public CreditAccountAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreditAccountAllOfAttributes creditAccountAllOfAttributes = (CreditAccountAllOfAttributes) o; + return Objects.equals(this.createdAt, creditAccountAllOfAttributes.createdAt) && + Objects.equals(this.name, creditAccountAllOfAttributes.name) && + Objects.equals(this.creditTerms, creditAccountAllOfAttributes.creditTerms) && + Objects.equals(this.currency, creditAccountAllOfAttributes.currency) && + Objects.equals(this.balance, creditAccountAllOfAttributes.balance) && + Objects.equals(this.hold, creditAccountAllOfAttributes.hold) && + Objects.equals(this.available, creditAccountAllOfAttributes.available) && + Objects.equals(this.tags, creditAccountAllOfAttributes.tags) && + Objects.equals(this.status, creditAccountAllOfAttributes.status) && + Objects.equals(this.closeReason, creditAccountAllOfAttributes.closeReason) && + Objects.equals(this.fraudReason, creditAccountAllOfAttributes.fraudReason) && + Objects.equals(this.closeReasonText, creditAccountAllOfAttributes.closeReasonText) && + Objects.equals(this.freezeReason, creditAccountAllOfAttributes.freezeReason) && + Objects.equals(this.creditLimit, creditAccountAllOfAttributes.creditLimit) && + Objects.equals(this.updatedAt, creditAccountAllOfAttributes.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, name, creditTerms, currency, balance, hold, available, tags, status, closeReason, fraudReason, closeReasonText, freezeReason, creditLimit, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreditAccountAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" creditTerms: ").append(toIndentedString(creditTerms)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" hold: ").append(toIndentedString(hold)).append("\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" closeReason: ").append(toIndentedString(closeReason)).append("\n"); + sb.append(" fraudReason: ").append(toIndentedString(fraudReason)).append("\n"); + sb.append(" closeReasonText: ").append(toIndentedString(closeReasonText)).append("\n"); + sb.append(" freezeReason: ").append(toIndentedString(freezeReason)).append("\n"); + sb.append(" creditLimit: ").append(toIndentedString(creditLimit)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("name"); + openapiFields.add("creditTerms"); + openapiFields.add("currency"); + openapiFields.add("balance"); + openapiFields.add("hold"); + openapiFields.add("available"); + openapiFields.add("tags"); + openapiFields.add("status"); + openapiFields.add("closeReason"); + openapiFields.add("fraudReason"); + openapiFields.add("closeReasonText"); + openapiFields.add("freezeReason"); + openapiFields.add("creditLimit"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("creditTerms"); + openapiRequiredFields.add("currency"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("hold"); + openapiRequiredFields.add("available"); + openapiRequiredFields.add("tags"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("creditLimit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreditAccountAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreditAccountAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreditAccountAllOfAttributes is not found in the empty JSON string", CreditAccountAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreditAccountAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreditAccountAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreditAccountAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("creditTerms").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creditTerms` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditTerms").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("closeReason") != null && !jsonObj.get("closeReason").isJsonNull()) && !jsonObj.get("closeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `closeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("closeReason").toString())); + } + if ((jsonObj.get("fraudReason") != null && !jsonObj.get("fraudReason").isJsonNull()) && !jsonObj.get("fraudReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fraudReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fraudReason").toString())); + } + if ((jsonObj.get("closeReasonText") != null && !jsonObj.get("closeReasonText").isJsonNull()) && !jsonObj.get("closeReasonText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `closeReasonText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("closeReasonText").toString())); + } + if ((jsonObj.get("freezeReason") != null && !jsonObj.get("freezeReason").isJsonNull()) && !jsonObj.get("freezeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `freezeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("freezeReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreditAccountAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreditAccountAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreditAccountAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreditAccountAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreditAccountAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreditAccountAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreditAccountAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to CreditAccountAllOfAttributes + */ + public static CreditAccountAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreditAccountAllOfAttributes.class); + } + + /** + * Convert an instance of CreditAccountAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreditAccountRelationships.java b/src/main/java/org/openapitools/client/model/CreditAccountRelationships.java new file mode 100644 index 00000000..3eb9ada0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreditAccountRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerLinkage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreditAccountRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreditAccountRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private CustomerLinkage customer; + + public CreditAccountRelationships() { + } + + public CreditAccountRelationships customer(CustomerLinkage customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public CustomerLinkage getCustomer() { + return customer; + } + + + public void setCustomer(CustomerLinkage customer) { + this.customer = customer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreditAccountRelationships creditAccountRelationships = (CreditAccountRelationships) o; + return Objects.equals(this.customer, creditAccountRelationships.customer); + } + + @Override + public int hashCode() { + return Objects.hash(customer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreditAccountRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreditAccountRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreditAccountRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreditAccountRelationships is not found in the empty JSON string", CreditAccountRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreditAccountRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreditAccountRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreditAccountRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `customer` + CustomerLinkage.validateJsonElement(jsonObj.get("customer")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreditAccountRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreditAccountRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreditAccountRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreditAccountRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreditAccountRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreditAccountRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreditAccountRelationships + * @throws IOException if the JSON string is invalid with respect to CreditAccountRelationships + */ + public static CreditAccountRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreditAccountRelationships.class); + } + + /** + * Convert an instance of CreditAccountRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreditLimits.java b/src/main/java/org/openapitools/client/model/CreditLimits.java new file mode 100644 index 00000000..6aab76e7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreditLimits.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreditLimitsAllOfAttributes; +import org.openapitools.client.model.Limits1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreditLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreditLimits extends Limits1 { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CreditLimitsAllOfAttributes attributes; + + public CreditLimits() { + this.type = this.getClass().getSimpleName(); + } + + public CreditLimits attributes(CreditLimitsAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CreditLimitsAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CreditLimitsAllOfAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreditLimits creditLimits = (CreditLimits) o; + return Objects.equals(this.attributes, creditLimits.attributes) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreditLimits {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreditLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreditLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreditLimits is not found in the empty JSON string", CreditLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreditLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreditLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreditLimits.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreditLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreditLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreditLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreditLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreditLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreditLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreditLimits + * @throws IOException if the JSON string is invalid with respect to CreditLimits + */ + public static CreditLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreditLimits.class); + } + + /** + * Convert an instance of CreditLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreditLimitsAllOfAttributes.java b/src/main/java/org/openapitools/client/model/CreditLimitsAllOfAttributes.java new file mode 100644 index 00000000..1eb0ed36 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CreditLimitsAllOfAttributes.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DepositLimitsAllOfAttributesCard; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CreditLimitsAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreditLimitsAllOfAttributes { + public static final String SERIALIZED_NAME_CARD = "card"; + @SerializedName(SERIALIZED_NAME_CARD) + private DepositLimitsAllOfAttributesCard card; + + public CreditLimitsAllOfAttributes() { + } + + public CreditLimitsAllOfAttributes card(DepositLimitsAllOfAttributesCard card) { + + this.card = card; + return this; + } + + /** + * Get card + * @return card + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesCard getCard() { + return card; + } + + + public void setCard(DepositLimitsAllOfAttributesCard card) { + this.card = card; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreditLimitsAllOfAttributes creditLimitsAllOfAttributes = (CreditLimitsAllOfAttributes) o; + return Objects.equals(this.card, creditLimitsAllOfAttributes.card); + } + + @Override + public int hashCode() { + return Objects.hash(card); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreditLimitsAllOfAttributes {\n"); + sb.append(" card: ").append(toIndentedString(card)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("card"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("card"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreditLimitsAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreditLimitsAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreditLimitsAllOfAttributes is not found in the empty JSON string", CreditLimitsAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreditLimitsAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreditLimitsAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreditLimitsAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `card` + DepositLimitsAllOfAttributesCard.validateJsonElement(jsonObj.get("card")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreditLimitsAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreditLimitsAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreditLimitsAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreditLimitsAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreditLimitsAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreditLimitsAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreditLimitsAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to CreditLimitsAllOfAttributes + */ + public static CreditLimitsAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreditLimitsAllOfAttributes.class); + } + + /** + * Convert an instance of CreditLimitsAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Customer.java b/src/main/java/org/openapitools/client/model/Customer.java new file mode 100644 index 00000000..3d4e1918 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Customer.java @@ -0,0 +1,212 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Customer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Customer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public Customer() { + this.type = this.getClass().getSimpleName(); + } + + public Customer id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Customer type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Customer customer = (Customer) o; + return Objects.equals(this.id, customer.id) && + Objects.equals(this.type, customer.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Customer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Customer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Customer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Customer is not found in the empty JSON string", Customer.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "businessCustomer": + BusinessCustomer.validateJsonElement(jsonElement); + break; + case "individualCustomer": + IndividualCustomer.validateJsonElement(jsonElement); + break; + case "trustCustomer": + TrustCustomer.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Customer given an JSON string + * + * @param jsonString JSON string + * @return An instance of Customer + * @throws IOException if the JSON string is invalid with respect to Customer + */ + public static Customer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Customer.class); + } + + /** + * Convert an instance of Customer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerLinkage.java b/src/main/java/org/openapitools/client/model/CustomerLinkage.java new file mode 100644 index 00000000..bcf5fd1e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerLinkage.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerLinkageData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerLinkage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerLinkage { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CustomerLinkageData data; + + public CustomerLinkage() { + } + + public CustomerLinkage data(CustomerLinkageData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public CustomerLinkageData getData() { + return data; + } + + + public void setData(CustomerLinkageData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerLinkage customerLinkage = (CustomerLinkage) o; + return Objects.equals(this.data, customerLinkage.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerLinkage {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerLinkage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerLinkage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerLinkage is not found in the empty JSON string", CustomerLinkage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerLinkage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerLinkage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerLinkage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + CustomerLinkageData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerLinkage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerLinkage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerLinkage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerLinkage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerLinkage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerLinkage given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerLinkage + * @throws IOException if the JSON string is invalid with respect to CustomerLinkage + */ + public static CustomerLinkage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerLinkage.class); + } + + /** + * Convert an instance of CustomerLinkage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerLinkageData.java b/src/main/java/org/openapitools/client/model/CustomerLinkageData.java new file mode 100644 index 00000000..c6d0d007 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerLinkageData.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerLinkageData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerLinkageData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CUSTOMER("customer"), + + BUSINESSCUSTOMER("businessCustomer"), + + INDIVIDUALCUSTOMER("individualCustomer"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public CustomerLinkageData() { + } + + public CustomerLinkageData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public CustomerLinkageData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerLinkageData customerLinkageData = (CustomerLinkageData) o; + return Objects.equals(this.type, customerLinkageData.type) && + Objects.equals(this.id, customerLinkageData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerLinkageData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerLinkageData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerLinkageData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerLinkageData is not found in the empty JSON string", CustomerLinkageData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerLinkageData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerLinkageData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerLinkageData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerLinkageData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerLinkageData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerLinkageData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerLinkageData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerLinkageData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerLinkageData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerLinkageData + * @throws IOException if the JSON string is invalid with respect to CustomerLinkageData + */ + public static CustomerLinkageData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerLinkageData.class); + } + + /** + * Convert an instance of CustomerLinkageData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerRelationship.java b/src/main/java/org/openapitools/client/model/CustomerRelationship.java new file mode 100644 index 00000000..17348479 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsCustomerData data; + + public CustomerRelationship() { + } + + public CustomerRelationship data(ReceivedPaymentRelationshipsCustomerData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsCustomerData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsCustomerData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerRelationship customerRelationship = (CustomerRelationship) o; + return Objects.equals(this.data, customerRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerRelationship is not found in the empty JSON string", CustomerRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsCustomerData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerRelationship + * @throws IOException if the JSON string is invalid with respect to CustomerRelationship + */ + public static CustomerRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerRelationship.class); + } + + /** + * Convert an instance of CustomerRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerRelationships.java b/src/main/java/org/openapitools/client/model/CustomerRelationships.java new file mode 100644 index 00000000..969d1689 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerRelationships.java @@ -0,0 +1,243 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.OrgRelationship; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerRelationships { + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private OrgRelationship org; + + public static final String SERIALIZED_NAME_APPLICATION = "application"; + @SerializedName(SERIALIZED_NAME_APPLICATION) + private Relationship application; + + public CustomerRelationships() { + } + + public CustomerRelationships org(OrgRelationship org) { + + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @javax.annotation.Nullable + public OrgRelationship getOrg() { + return org; + } + + + public void setOrg(OrgRelationship org) { + this.org = org; + } + + + public CustomerRelationships application(Relationship application) { + + this.application = application; + return this; + } + + /** + * Get application + * @return application + **/ + @javax.annotation.Nullable + public Relationship getApplication() { + return application; + } + + + public void setApplication(Relationship application) { + this.application = application; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerRelationships customerRelationships = (CustomerRelationships) o; + return Objects.equals(this.org, customerRelationships.org) && + Objects.equals(this.application, customerRelationships.application); + } + + @Override + public int hashCode() { + return Objects.hash(org, application); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerRelationships {\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("org"); + openapiFields.add("application"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerRelationships is not found in the empty JSON string", CustomerRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `org` + if (jsonObj.get("org") != null && !jsonObj.get("org").isJsonNull()) { + OrgRelationship.validateJsonElement(jsonObj.get("org")); + } + // validate the optional field `application` + if (jsonObj.get("application") != null && !jsonObj.get("application").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("application")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerRelationships + * @throws IOException if the JSON string is invalid with respect to CustomerRelationships + */ + public static CustomerRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerRelationships.class); + } + + /** + * Convert an instance of CustomerRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerRepaymentReturnedTransaction.java b/src/main/java/org/openapitools/client/model/CustomerRepaymentReturnedTransaction.java new file mode 100644 index 00000000..e586777a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerRepaymentReturnedTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerRepaymentReturnedTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerRepaymentReturnedTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public CustomerRepaymentReturnedTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public CustomerRepaymentReturnedTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CustomerRepaymentReturnedTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerRepaymentReturnedTransaction customerRepaymentReturnedTransaction = (CustomerRepaymentReturnedTransaction) o; + return Objects.equals(this.attributes, customerRepaymentReturnedTransaction.attributes) && + Objects.equals(this.relationships, customerRepaymentReturnedTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerRepaymentReturnedTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerRepaymentReturnedTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerRepaymentReturnedTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerRepaymentReturnedTransaction is not found in the empty JSON string", CustomerRepaymentReturnedTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerRepaymentReturnedTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerRepaymentReturnedTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerRepaymentReturnedTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerRepaymentReturnedTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerRepaymentReturnedTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerRepaymentReturnedTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerRepaymentReturnedTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerRepaymentReturnedTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerRepaymentReturnedTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerRepaymentReturnedTransaction + * @throws IOException if the JSON string is invalid with respect to CustomerRepaymentReturnedTransaction + */ + public static CustomerRepaymentReturnedTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerRepaymentReturnedTransaction.class); + } + + /** + * Convert an instance of CustomerRepaymentReturnedTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerRepaymentTransaction.java b/src/main/java/org/openapitools/client/model/CustomerRepaymentTransaction.java new file mode 100644 index 00000000..e9a91bd3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerRepaymentTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerRepaymentTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerRepaymentTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public CustomerRepaymentTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public CustomerRepaymentTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public CustomerRepaymentTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerRepaymentTransaction customerRepaymentTransaction = (CustomerRepaymentTransaction) o; + return Objects.equals(this.attributes, customerRepaymentTransaction.attributes) && + Objects.equals(this.relationships, customerRepaymentTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerRepaymentTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerRepaymentTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerRepaymentTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerRepaymentTransaction is not found in the empty JSON string", CustomerRepaymentTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerRepaymentTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerRepaymentTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerRepaymentTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerRepaymentTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerRepaymentTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerRepaymentTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerRepaymentTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerRepaymentTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerRepaymentTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerRepaymentTransaction + * @throws IOException if the JSON string is invalid with respect to CustomerRepaymentTransaction + */ + public static CustomerRepaymentTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerRepaymentTransaction.class); + } + + /** + * Convert an instance of CustomerRepaymentTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerToken.java b/src/main/java/org/openapitools/client/model/CustomerToken.java new file mode 100644 index 00000000..dd29d943 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerToken.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerTokenAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerToken { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "customerToken"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CustomerTokenAttributes attributes; + + public CustomerToken() { + } + + public CustomerToken type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CustomerToken attributes(CustomerTokenAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CustomerTokenAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CustomerTokenAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerToken customerToken = (CustomerToken) o; + return Objects.equals(this.type, customerToken.type) && + Objects.equals(this.attributes, customerToken.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerToken {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerToken.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerToken is not found in the empty JSON string", CustomerToken.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerToken.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerToken` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerToken.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CustomerTokenAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerToken read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerToken + * @throws IOException if the JSON string is invalid with respect to CustomerToken + */ + public static CustomerToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerToken.class); + } + + /** + * Convert an instance of CustomerToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerTokenAttributes.java b/src/main/java/org/openapitools/client/model/CustomerTokenAttributes.java new file mode 100644 index 00000000..6dbd22b4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerTokenAttributes.java @@ -0,0 +1,236 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerTokenAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerTokenAttributes { + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public static final String SERIALIZED_NAME_EXPIRES_IN = "expiresIn"; + @SerializedName(SERIALIZED_NAME_EXPIRES_IN) + private Integer expiresIn; + + public CustomerTokenAttributes() { + } + + public CustomerTokenAttributes token(String token) { + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nullable + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + public CustomerTokenAttributes expiresIn(Integer expiresIn) { + + this.expiresIn = expiresIn; + return this; + } + + /** + * Get expiresIn + * @return expiresIn + **/ + @javax.annotation.Nullable + public Integer getExpiresIn() { + return expiresIn; + } + + + public void setExpiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerTokenAttributes customerTokenAttributes = (CustomerTokenAttributes) o; + return Objects.equals(this.token, customerTokenAttributes.token) && + Objects.equals(this.expiresIn, customerTokenAttributes.expiresIn); + } + + @Override + public int hashCode() { + return Objects.hash(token, expiresIn); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerTokenAttributes {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("expiresIn"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerTokenAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerTokenAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerTokenAttributes is not found in the empty JSON string", CustomerTokenAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerTokenAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerTokenAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerTokenAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerTokenAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerTokenAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerTokenAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerTokenAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerTokenAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerTokenAttributes + * @throws IOException if the JSON string is invalid with respect to CustomerTokenAttributes + */ + public static CustomerTokenAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerTokenAttributes.class); + } + + /** + * Convert an instance of CustomerTokenAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerTokenVerification.java b/src/main/java/org/openapitools/client/model/CustomerTokenVerification.java new file mode 100644 index 00000000..231494db --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerTokenVerification.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerTokenVerificationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerTokenVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerTokenVerification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "customerTokenVerification"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CustomerTokenVerificationAttributes attributes; + + public CustomerTokenVerification() { + } + + public CustomerTokenVerification type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CustomerTokenVerification attributes(CustomerTokenVerificationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CustomerTokenVerificationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CustomerTokenVerificationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerTokenVerification customerTokenVerification = (CustomerTokenVerification) o; + return Objects.equals(this.type, customerTokenVerification.type) && + Objects.equals(this.attributes, customerTokenVerification.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerTokenVerification {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerTokenVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerTokenVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerTokenVerification is not found in the empty JSON string", CustomerTokenVerification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerTokenVerification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerTokenVerification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerTokenVerification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + CustomerTokenVerificationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerTokenVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerTokenVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerTokenVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerTokenVerification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerTokenVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerTokenVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerTokenVerification + * @throws IOException if the JSON string is invalid with respect to CustomerTokenVerification + */ + public static CustomerTokenVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerTokenVerification.class); + } + + /** + * Convert an instance of CustomerTokenVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomerTokenVerificationAttributes.java b/src/main/java/org/openapitools/client/model/CustomerTokenVerificationAttributes.java new file mode 100644 index 00000000..ffdd3581 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomerTokenVerificationAttributes.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomerTokenVerificationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomerTokenVerificationAttributes { + public static final String SERIALIZED_NAME_VERIFICATION_TOKEN = "verificationToken"; + @SerializedName(SERIALIZED_NAME_VERIFICATION_TOKEN) + private String verificationToken; + + public CustomerTokenVerificationAttributes() { + } + + public CustomerTokenVerificationAttributes verificationToken(String verificationToken) { + + this.verificationToken = verificationToken; + return this; + } + + /** + * Get verificationToken + * @return verificationToken + **/ + @javax.annotation.Nullable + public String getVerificationToken() { + return verificationToken; + } + + + public void setVerificationToken(String verificationToken) { + this.verificationToken = verificationToken; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerTokenVerificationAttributes customerTokenVerificationAttributes = (CustomerTokenVerificationAttributes) o; + return Objects.equals(this.verificationToken, customerTokenVerificationAttributes.verificationToken); + } + + @Override + public int hashCode() { + return Objects.hash(verificationToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerTokenVerificationAttributes {\n"); + sb.append(" verificationToken: ").append(toIndentedString(verificationToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("verificationToken"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerTokenVerificationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerTokenVerificationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerTokenVerificationAttributes is not found in the empty JSON string", CustomerTokenVerificationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerTokenVerificationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerTokenVerificationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("verificationToken") != null && !jsonObj.get("verificationToken").isJsonNull()) && !jsonObj.get("verificationToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `verificationToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verificationToken").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerTokenVerificationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerTokenVerificationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerTokenVerificationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerTokenVerificationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerTokenVerificationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerTokenVerificationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerTokenVerificationAttributes + * @throws IOException if the JSON string is invalid with respect to CustomerTokenVerificationAttributes + */ + public static CustomerTokenVerificationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerTokenVerificationAttributes.class); + } + + /** + * Convert an instance of CustomerTokenVerificationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomersRelationship.java b/src/main/java/org/openapitools/client/model/CustomersRelationship.java new file mode 100644 index 00000000..f134bf9a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomersRelationship.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.CustomersRelationshipDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomersRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomersRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public CustomersRelationship() { + } + + public CustomersRelationship data(List data) { + + this.data = data; + return this; + } + + public CustomersRelationship addDataItem(CustomersRelationshipDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomersRelationship customersRelationship = (CustomersRelationship) o; + return Objects.equals(this.data, customersRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomersRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomersRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomersRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomersRelationship is not found in the empty JSON string", CustomersRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomersRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomersRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + CustomersRelationshipDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomersRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomersRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomersRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomersRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomersRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomersRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomersRelationship + * @throws IOException if the JSON string is invalid with respect to CustomersRelationship + */ + public static CustomersRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomersRelationship.class); + } + + /** + * Convert an instance of CustomersRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CustomersRelationshipDataInner.java b/src/main/java/org/openapitools/client/model/CustomersRelationshipDataInner.java new file mode 100644 index 00000000..d497122b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/CustomersRelationshipDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CustomersRelationshipDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CustomersRelationshipDataInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "customer"; + + public CustomersRelationshipDataInner() { + } + + public CustomersRelationshipDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public CustomersRelationshipDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomersRelationshipDataInner customersRelationshipDataInner = (CustomersRelationshipDataInner) o; + return Objects.equals(this.id, customersRelationshipDataInner.id) && + Objects.equals(this.type, customersRelationshipDataInner.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomersRelationshipDataInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomersRelationshipDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomersRelationshipDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomersRelationshipDataInner is not found in the empty JSON string", CustomersRelationshipDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomersRelationshipDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomersRelationshipDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomersRelationshipDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomersRelationshipDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomersRelationshipDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomersRelationshipDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomersRelationshipDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomersRelationshipDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomersRelationshipDataInner + * @throws IOException if the JSON string is invalid with respect to CustomersRelationshipDataInner + */ + public static CustomersRelationshipDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomersRelationshipDataInner.class); + } + + /** + * Convert an instance of CustomersRelationshipDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DeclineAuthorizationRequest.java b/src/main/java/org/openapitools/client/model/DeclineAuthorizationRequest.java new file mode 100644 index 00000000..c6278b32 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DeclineAuthorizationRequest.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DeclineAuthorizationRequestAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeclineAuthorizationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DeclineAuthorizationRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "declineAuthorizationRequest"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DeclineAuthorizationRequestAttributes attributes; + + public DeclineAuthorizationRequest() { + } + + public DeclineAuthorizationRequest type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public DeclineAuthorizationRequest attributes(DeclineAuthorizationRequestAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public DeclineAuthorizationRequestAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DeclineAuthorizationRequestAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeclineAuthorizationRequest declineAuthorizationRequest = (DeclineAuthorizationRequest) o; + return Objects.equals(this.type, declineAuthorizationRequest.type) && + Objects.equals(this.attributes, declineAuthorizationRequest.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeclineAuthorizationRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeclineAuthorizationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeclineAuthorizationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeclineAuthorizationRequest is not found in the empty JSON string", DeclineAuthorizationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeclineAuthorizationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeclineAuthorizationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeclineAuthorizationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + DeclineAuthorizationRequestAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeclineAuthorizationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeclineAuthorizationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeclineAuthorizationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeclineAuthorizationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeclineAuthorizationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeclineAuthorizationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeclineAuthorizationRequest + * @throws IOException if the JSON string is invalid with respect to DeclineAuthorizationRequest + */ + public static DeclineAuthorizationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeclineAuthorizationRequest.class); + } + + /** + * Convert an instance of DeclineAuthorizationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DeclineAuthorizationRequestAttributes.java b/src/main/java/org/openapitools/client/model/DeclineAuthorizationRequestAttributes.java new file mode 100644 index 00000000..c4a81d22 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DeclineAuthorizationRequestAttributes.java @@ -0,0 +1,267 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeclineAuthorizationRequestAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DeclineAuthorizationRequestAttributes { + /** + * Gets or Sets reason + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + ACCOUNTCLOSED("AccountClosed"), + + CARDEXCEEDSAMOUNTLIMIT("CardExceedsAmountLimit"), + + DONOTHONOR("DoNotHonor"), + + INSUFFICIENTFUNDS("InsufficientFunds"), + + INVALIDMERCHANT("InvalidMerchant"), + + REFERTOCARDISSUER("ReferToCardIssuer"), + + RESTRICTEDCARD("RestrictedCard"), + + TRANSACTIONNOTPERMITTEDTOCARDHOLDER("TransactionNotPermittedToCardholder"); + + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReasonEnum reason; + + public DeclineAuthorizationRequestAttributes() { + } + + public DeclineAuthorizationRequestAttributes reason(ReasonEnum reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public ReasonEnum getReason() { + return reason; + } + + + public void setReason(ReasonEnum reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeclineAuthorizationRequestAttributes declineAuthorizationRequestAttributes = (DeclineAuthorizationRequestAttributes) o; + return Objects.equals(this.reason, declineAuthorizationRequestAttributes.reason); + } + + @Override + public int hashCode() { + return Objects.hash(reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeclineAuthorizationRequestAttributes {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeclineAuthorizationRequestAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeclineAuthorizationRequestAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeclineAuthorizationRequestAttributes is not found in the empty JSON string", DeclineAuthorizationRequestAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeclineAuthorizationRequestAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeclineAuthorizationRequestAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeclineAuthorizationRequestAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeclineAuthorizationRequestAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeclineAuthorizationRequestAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeclineAuthorizationRequestAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeclineAuthorizationRequestAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeclineAuthorizationRequestAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeclineAuthorizationRequestAttributes + * @throws IOException if the JSON string is invalid with respect to DeclineAuthorizationRequestAttributes + */ + public static DeclineAuthorizationRequestAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeclineAuthorizationRequestAttributes.class); + } + + /** + * Convert an instance of DeclineAuthorizationRequestAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositAccount.java b/src/main/java/org/openapitools/client/model/DepositAccount.java new file mode 100644 index 00000000..c50a70c1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositAccount.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Account; +import org.openapitools.client.model.DepositAccountAllOfAttributes; +import org.openapitools.client.model.DepositAccountRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositAccount extends Account { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DepositAccountAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private DepositAccountRelationships relationships; + + public DepositAccount() { + this.type = this.getClass().getSimpleName(); + } + + public DepositAccount attributes(DepositAccountAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public DepositAccountAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DepositAccountAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public DepositAccount relationships(DepositAccountRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public DepositAccountRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(DepositAccountRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositAccount depositAccount = (DepositAccount) o; + return Objects.equals(this.attributes, depositAccount.attributes) && + Objects.equals(this.relationships, depositAccount.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositAccount {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositAccount is not found in the empty JSON string", DepositAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositAccount + * @throws IOException if the JSON string is invalid with respect to DepositAccount + */ + public static DepositAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositAccount.class); + } + + /** + * Convert an instance of DepositAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositAccountAllOfAttributes.java b/src/main/java/org/openapitools/client/model/DepositAccountAllOfAttributes.java new file mode 100644 index 00000000..7c342024 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositAccountAllOfAttributes.java @@ -0,0 +1,1027 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.DepositAccountAllOfAttributesSecondaryAccountNumber; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositAccountAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositAccountAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DEPOSIT_PRODUCT = "depositProduct"; + @SerializedName(SERIALIZED_NAME_DEPOSIT_PRODUCT) + private String depositProduct; + + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public static final String SERIALIZED_NAME_SECONDARY_ACCOUNT_NUMBER = "secondaryAccountNumber"; + @SerializedName(SERIALIZED_NAME_SECONDARY_ACCOUNT_NUMBER) + private DepositAccountAllOfAttributesSecondaryAccountNumber secondaryAccountNumber; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency = "USD"; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_OVERDRAFT_LIMIT = "overdraftLimit"; + @SerializedName(SERIALIZED_NAME_OVERDRAFT_LIMIT) + private Integer overdraftLimit; + + public static final String SERIALIZED_NAME_HOLD = "hold"; + @SerializedName(SERIALIZED_NAME_HOLD) + private Integer hold; + + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + private Integer available; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + OPEN("Open"), + + CLOSED("Closed"), + + FROZEN("Frozen"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + /** + * Gets or Sets closeReason + */ + @JsonAdapter(CloseReasonEnum.Adapter.class) + public enum CloseReasonEnum { + BYCUSTOMER("ByCustomer"), + + FRAUD("Fraud"); + + private String value; + + CloseReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CloseReasonEnum fromValue(String value) { + for (CloseReasonEnum b : CloseReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CloseReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CloseReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CloseReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CLOSE_REASON = "closeReason"; + @SerializedName(SERIALIZED_NAME_CLOSE_REASON) + private CloseReasonEnum closeReason; + + /** + * Gets or Sets fraudReason + */ + @JsonAdapter(FraudReasonEnum.Adapter.class) + public enum FraudReasonEnum { + ACHACTIVITY("ACHActivity"), + + CARDACTIVITY("CardActivity"), + + CHECKACTIVITY("CheckActivity"), + + APPLICATIONHISTORY("ApplicationHistory"), + + ACCOUNTACTIVITY("AccountActivity"), + + CLIENTIDENTIFIED("ClientIdentified"), + + IDENTITYTHEFT("IdentityTheft"), + + LINKEDTOFRAUDULENTCUSTOMER("LinkedToFraudulentCustomer"); + + private String value; + + FraudReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FraudReasonEnum fromValue(String value) { + for (FraudReasonEnum b : FraudReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final FraudReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FraudReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FraudReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_FRAUD_REASON = "fraudReason"; + @SerializedName(SERIALIZED_NAME_FRAUD_REASON) + private FraudReasonEnum fraudReason; + + public static final String SERIALIZED_NAME_CLOSE_REASON_TEXT = "closeReasonText"; + @SerializedName(SERIALIZED_NAME_CLOSE_REASON_TEXT) + private String closeReasonText; + + public static final String SERIALIZED_NAME_FREEZE_REASON = "freezeReason"; + @SerializedName(SERIALIZED_NAME_FREEZE_REASON) + private String freezeReason; + + public static final String SERIALIZED_NAME_MASKED_ACCOUNT_NUMBER = "maskedAccountNumber"; + @SerializedName(SERIALIZED_NAME_MASKED_ACCOUNT_NUMBER) + private String maskedAccountNumber; + + public static final String SERIALIZED_NAME_IS_OVERDRAWN_WITHIN_LIMIT = "isOverdrawnWithinLimit"; + @SerializedName(SERIALIZED_NAME_IS_OVERDRAWN_WITHIN_LIMIT) + private Boolean isOverdrawnWithinLimit; + + /** + * Gets or Sets dacaStatus + */ + @JsonAdapter(DacaStatusEnum.Adapter.class) + public enum DacaStatusEnum { + ACTIVATED("Activated"), + + ENTERED("Entered"); + + private String value; + + DacaStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DacaStatusEnum fromValue(String value) { + for (DacaStatusEnum b : DacaStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DacaStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DacaStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DacaStatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DACA_STATUS = "dacaStatus"; + @SerializedName(SERIALIZED_NAME_DACA_STATUS) + private DacaStatusEnum dacaStatus; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public DepositAccountAllOfAttributes() { + } + + public DepositAccountAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public DepositAccountAllOfAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public DepositAccountAllOfAttributes depositProduct(String depositProduct) { + + this.depositProduct = depositProduct; + return this; + } + + /** + * Get depositProduct + * @return depositProduct + **/ + @javax.annotation.Nonnull + public String getDepositProduct() { + return depositProduct; + } + + + public void setDepositProduct(String depositProduct) { + this.depositProduct = depositProduct; + } + + + public DepositAccountAllOfAttributes routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public DepositAccountAllOfAttributes accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nullable + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public DepositAccountAllOfAttributes secondaryAccountNumber(DepositAccountAllOfAttributesSecondaryAccountNumber secondaryAccountNumber) { + + this.secondaryAccountNumber = secondaryAccountNumber; + return this; + } + + /** + * Get secondaryAccountNumber + * @return secondaryAccountNumber + **/ + @javax.annotation.Nullable + public DepositAccountAllOfAttributesSecondaryAccountNumber getSecondaryAccountNumber() { + return secondaryAccountNumber; + } + + + public void setSecondaryAccountNumber(DepositAccountAllOfAttributesSecondaryAccountNumber secondaryAccountNumber) { + this.secondaryAccountNumber = secondaryAccountNumber; + } + + + public DepositAccountAllOfAttributes currency(String currency) { + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + this.currency = currency; + } + + + public DepositAccountAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public DepositAccountAllOfAttributes overdraftLimit(Integer overdraftLimit) { + + this.overdraftLimit = overdraftLimit; + return this; + } + + /** + * Get overdraftLimit + * minimum: 0 + * @return overdraftLimit + **/ + @javax.annotation.Nullable + public Integer getOverdraftLimit() { + return overdraftLimit; + } + + + public void setOverdraftLimit(Integer overdraftLimit) { + this.overdraftLimit = overdraftLimit; + } + + + public DepositAccountAllOfAttributes hold(Integer hold) { + + this.hold = hold; + return this; + } + + /** + * Get hold + * @return hold + **/ + @javax.annotation.Nonnull + public Integer getHold() { + return hold; + } + + + public void setHold(Integer hold) { + this.hold = hold; + } + + + public DepositAccountAllOfAttributes available(Integer available) { + + this.available = available; + return this; + } + + /** + * Get available + * @return available + **/ + @javax.annotation.Nonnull + public Integer getAvailable() { + return available; + } + + + public void setAvailable(Integer available) { + this.available = available; + } + + + public DepositAccountAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nonnull + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public DepositAccountAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public DepositAccountAllOfAttributes closeReason(CloseReasonEnum closeReason) { + + this.closeReason = closeReason; + return this; + } + + /** + * Get closeReason + * @return closeReason + **/ + @javax.annotation.Nullable + public CloseReasonEnum getCloseReason() { + return closeReason; + } + + + public void setCloseReason(CloseReasonEnum closeReason) { + this.closeReason = closeReason; + } + + + public DepositAccountAllOfAttributes fraudReason(FraudReasonEnum fraudReason) { + + this.fraudReason = fraudReason; + return this; + } + + /** + * Get fraudReason + * @return fraudReason + **/ + @javax.annotation.Nullable + public FraudReasonEnum getFraudReason() { + return fraudReason; + } + + + public void setFraudReason(FraudReasonEnum fraudReason) { + this.fraudReason = fraudReason; + } + + + public DepositAccountAllOfAttributes closeReasonText(String closeReasonText) { + + this.closeReasonText = closeReasonText; + return this; + } + + /** + * Get closeReasonText + * @return closeReasonText + **/ + @javax.annotation.Nullable + public String getCloseReasonText() { + return closeReasonText; + } + + + public void setCloseReasonText(String closeReasonText) { + this.closeReasonText = closeReasonText; + } + + + public DepositAccountAllOfAttributes freezeReason(String freezeReason) { + + this.freezeReason = freezeReason; + return this; + } + + /** + * Get freezeReason + * @return freezeReason + **/ + @javax.annotation.Nullable + public String getFreezeReason() { + return freezeReason; + } + + + public void setFreezeReason(String freezeReason) { + this.freezeReason = freezeReason; + } + + + public DepositAccountAllOfAttributes maskedAccountNumber(String maskedAccountNumber) { + + this.maskedAccountNumber = maskedAccountNumber; + return this; + } + + /** + * Get maskedAccountNumber + * @return maskedAccountNumber + **/ + @javax.annotation.Nullable + public String getMaskedAccountNumber() { + return maskedAccountNumber; + } + + + public void setMaskedAccountNumber(String maskedAccountNumber) { + this.maskedAccountNumber = maskedAccountNumber; + } + + + public DepositAccountAllOfAttributes isOverdrawnWithinLimit(Boolean isOverdrawnWithinLimit) { + + this.isOverdrawnWithinLimit = isOverdrawnWithinLimit; + return this; + } + + /** + * Get isOverdrawnWithinLimit + * @return isOverdrawnWithinLimit + **/ + @javax.annotation.Nullable + public Boolean getIsOverdrawnWithinLimit() { + return isOverdrawnWithinLimit; + } + + + public void setIsOverdrawnWithinLimit(Boolean isOverdrawnWithinLimit) { + this.isOverdrawnWithinLimit = isOverdrawnWithinLimit; + } + + + public DepositAccountAllOfAttributes dacaStatus(DacaStatusEnum dacaStatus) { + + this.dacaStatus = dacaStatus; + return this; + } + + /** + * Get dacaStatus + * @return dacaStatus + **/ + @javax.annotation.Nullable + public DacaStatusEnum getDacaStatus() { + return dacaStatus; + } + + + public void setDacaStatus(DacaStatusEnum dacaStatus) { + this.dacaStatus = dacaStatus; + } + + + public DepositAccountAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositAccountAllOfAttributes depositAccountAllOfAttributes = (DepositAccountAllOfAttributes) o; + return Objects.equals(this.createdAt, depositAccountAllOfAttributes.createdAt) && + Objects.equals(this.name, depositAccountAllOfAttributes.name) && + Objects.equals(this.depositProduct, depositAccountAllOfAttributes.depositProduct) && + Objects.equals(this.routingNumber, depositAccountAllOfAttributes.routingNumber) && + Objects.equals(this.accountNumber, depositAccountAllOfAttributes.accountNumber) && + Objects.equals(this.secondaryAccountNumber, depositAccountAllOfAttributes.secondaryAccountNumber) && + Objects.equals(this.currency, depositAccountAllOfAttributes.currency) && + Objects.equals(this.balance, depositAccountAllOfAttributes.balance) && + Objects.equals(this.overdraftLimit, depositAccountAllOfAttributes.overdraftLimit) && + Objects.equals(this.hold, depositAccountAllOfAttributes.hold) && + Objects.equals(this.available, depositAccountAllOfAttributes.available) && + Objects.equals(this.tags, depositAccountAllOfAttributes.tags) && + Objects.equals(this.status, depositAccountAllOfAttributes.status) && + Objects.equals(this.closeReason, depositAccountAllOfAttributes.closeReason) && + Objects.equals(this.fraudReason, depositAccountAllOfAttributes.fraudReason) && + Objects.equals(this.closeReasonText, depositAccountAllOfAttributes.closeReasonText) && + Objects.equals(this.freezeReason, depositAccountAllOfAttributes.freezeReason) && + Objects.equals(this.maskedAccountNumber, depositAccountAllOfAttributes.maskedAccountNumber) && + Objects.equals(this.isOverdrawnWithinLimit, depositAccountAllOfAttributes.isOverdrawnWithinLimit) && + Objects.equals(this.dacaStatus, depositAccountAllOfAttributes.dacaStatus) && + Objects.equals(this.updatedAt, depositAccountAllOfAttributes.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, name, depositProduct, routingNumber, accountNumber, secondaryAccountNumber, currency, balance, overdraftLimit, hold, available, tags, status, closeReason, fraudReason, closeReasonText, freezeReason, maskedAccountNumber, isOverdrawnWithinLimit, dacaStatus, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositAccountAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" depositProduct: ").append(toIndentedString(depositProduct)).append("\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" secondaryAccountNumber: ").append(toIndentedString(secondaryAccountNumber)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" overdraftLimit: ").append(toIndentedString(overdraftLimit)).append("\n"); + sb.append(" hold: ").append(toIndentedString(hold)).append("\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" closeReason: ").append(toIndentedString(closeReason)).append("\n"); + sb.append(" fraudReason: ").append(toIndentedString(fraudReason)).append("\n"); + sb.append(" closeReasonText: ").append(toIndentedString(closeReasonText)).append("\n"); + sb.append(" freezeReason: ").append(toIndentedString(freezeReason)).append("\n"); + sb.append(" maskedAccountNumber: ").append(toIndentedString(maskedAccountNumber)).append("\n"); + sb.append(" isOverdrawnWithinLimit: ").append(toIndentedString(isOverdrawnWithinLimit)).append("\n"); + sb.append(" dacaStatus: ").append(toIndentedString(dacaStatus)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("name"); + openapiFields.add("depositProduct"); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("secondaryAccountNumber"); + openapiFields.add("currency"); + openapiFields.add("balance"); + openapiFields.add("overdraftLimit"); + openapiFields.add("hold"); + openapiFields.add("available"); + openapiFields.add("tags"); + openapiFields.add("status"); + openapiFields.add("closeReason"); + openapiFields.add("fraudReason"); + openapiFields.add("closeReasonText"); + openapiFields.add("freezeReason"); + openapiFields.add("maskedAccountNumber"); + openapiFields.add("isOverdrawnWithinLimit"); + openapiFields.add("dacaStatus"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("depositProduct"); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("currency"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("hold"); + openapiRequiredFields.add("available"); + openapiRequiredFields.add("tags"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositAccountAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositAccountAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositAccountAllOfAttributes is not found in the empty JSON string", DepositAccountAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositAccountAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositAccountAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositAccountAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("depositProduct").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `depositProduct` to be a primitive type in the JSON string but got `%s`", jsonObj.get("depositProduct").toString())); + } + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if ((jsonObj.get("accountNumber") != null && !jsonObj.get("accountNumber").isJsonNull()) && !jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + // validate the optional field `secondaryAccountNumber` + if (jsonObj.get("secondaryAccountNumber") != null && !jsonObj.get("secondaryAccountNumber").isJsonNull()) { + DepositAccountAllOfAttributesSecondaryAccountNumber.validateJsonElement(jsonObj.get("secondaryAccountNumber")); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("closeReason") != null && !jsonObj.get("closeReason").isJsonNull()) && !jsonObj.get("closeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `closeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("closeReason").toString())); + } + if ((jsonObj.get("fraudReason") != null && !jsonObj.get("fraudReason").isJsonNull()) && !jsonObj.get("fraudReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fraudReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fraudReason").toString())); + } + if ((jsonObj.get("closeReasonText") != null && !jsonObj.get("closeReasonText").isJsonNull()) && !jsonObj.get("closeReasonText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `closeReasonText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("closeReasonText").toString())); + } + if ((jsonObj.get("freezeReason") != null && !jsonObj.get("freezeReason").isJsonNull()) && !jsonObj.get("freezeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `freezeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("freezeReason").toString())); + } + if ((jsonObj.get("maskedAccountNumber") != null && !jsonObj.get("maskedAccountNumber").isJsonNull()) && !jsonObj.get("maskedAccountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedAccountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedAccountNumber").toString())); + } + if ((jsonObj.get("dacaStatus") != null && !jsonObj.get("dacaStatus").isJsonNull()) && !jsonObj.get("dacaStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dacaStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dacaStatus").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositAccountAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositAccountAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositAccountAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositAccountAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositAccountAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositAccountAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositAccountAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to DepositAccountAllOfAttributes + */ + public static DepositAccountAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositAccountAllOfAttributes.class); + } + + /** + * Convert an instance of DepositAccountAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositAccountAllOfAttributesSecondaryAccountNumber.java b/src/main/java/org/openapitools/client/model/DepositAccountAllOfAttributesSecondaryAccountNumber.java new file mode 100644 index 00000000..77dbf4a4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositAccountAllOfAttributesSecondaryAccountNumber.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositAccountAllOfAttributesSecondaryAccountNumber + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositAccountAllOfAttributesSecondaryAccountNumber { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public DepositAccountAllOfAttributesSecondaryAccountNumber() { + } + + public DepositAccountAllOfAttributesSecondaryAccountNumber routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public DepositAccountAllOfAttributesSecondaryAccountNumber accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositAccountAllOfAttributesSecondaryAccountNumber depositAccountAllOfAttributesSecondaryAccountNumber = (DepositAccountAllOfAttributesSecondaryAccountNumber) o; + return Objects.equals(this.routingNumber, depositAccountAllOfAttributesSecondaryAccountNumber.routingNumber) && + Objects.equals(this.accountNumber, depositAccountAllOfAttributesSecondaryAccountNumber.accountNumber); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, accountNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositAccountAllOfAttributesSecondaryAccountNumber {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositAccountAllOfAttributesSecondaryAccountNumber + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositAccountAllOfAttributesSecondaryAccountNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositAccountAllOfAttributesSecondaryAccountNumber is not found in the empty JSON string", DepositAccountAllOfAttributesSecondaryAccountNumber.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositAccountAllOfAttributesSecondaryAccountNumber.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositAccountAllOfAttributesSecondaryAccountNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositAccountAllOfAttributesSecondaryAccountNumber.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositAccountAllOfAttributesSecondaryAccountNumber.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositAccountAllOfAttributesSecondaryAccountNumber' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositAccountAllOfAttributesSecondaryAccountNumber.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositAccountAllOfAttributesSecondaryAccountNumber value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositAccountAllOfAttributesSecondaryAccountNumber read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositAccountAllOfAttributesSecondaryAccountNumber given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositAccountAllOfAttributesSecondaryAccountNumber + * @throws IOException if the JSON string is invalid with respect to DepositAccountAllOfAttributesSecondaryAccountNumber + */ + public static DepositAccountAllOfAttributesSecondaryAccountNumber fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositAccountAllOfAttributesSecondaryAccountNumber.class); + } + + /** + * Convert an instance of DepositAccountAllOfAttributesSecondaryAccountNumber to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositAccountRelationships.java b/src/main/java/org/openapitools/client/model/DepositAccountRelationships.java new file mode 100644 index 00000000..28fb20ba --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositAccountRelationships.java @@ -0,0 +1,286 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerLinkage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositAccountRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositAccountRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private CustomerLinkage customer; + + public DepositAccountRelationships() { + } + + public DepositAccountRelationships customer(CustomerLinkage customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public CustomerLinkage getCustomer() { + return customer; + } + + + public void setCustomer(CustomerLinkage customer) { + this.customer = customer; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DepositAccountRelationships instance itself + */ + public DepositAccountRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositAccountRelationships depositAccountRelationships = (DepositAccountRelationships) o; + return Objects.equals(this.customer, depositAccountRelationships.customer)&& + Objects.equals(this.additionalProperties, depositAccountRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(customer, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositAccountRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositAccountRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositAccountRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositAccountRelationships is not found in the empty JSON string", DepositAccountRelationships.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + CustomerLinkage.validateJsonElement(jsonObj.get("customer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositAccountRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositAccountRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositAccountRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositAccountRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DepositAccountRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DepositAccountRelationships instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositAccountRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositAccountRelationships + * @throws IOException if the JSON string is invalid with respect to DepositAccountRelationships + */ + public static DepositAccountRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositAccountRelationships.class); + } + + /** + * Convert an instance of DepositAccountRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimits.java b/src/main/java/org/openapitools/client/model/DepositLimits.java new file mode 100644 index 00000000..88b793ea --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimits.java @@ -0,0 +1,218 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DepositLimitsAllOfAttributes; +import org.openapitools.client.model.Limits1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimits extends Limits1 { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DepositLimitsAllOfAttributes attributes; + + public DepositLimits() { + this.type = this.getClass().getSimpleName(); + } + + public DepositLimits attributes(DepositLimitsAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DepositLimitsAllOfAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimits depositLimits = (DepositLimits) o; + return Objects.equals(this.attributes, depositLimits.attributes) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimits {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimits is not found in the empty JSON string", DepositLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimits.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimits + * @throws IOException if the JSON string is invalid with respect to DepositLimits + */ + public static DepositLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimits.class); + } + + /** + * Convert an instance of DepositLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributes.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributes.java new file mode 100644 index 00000000..cab5e31f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributes.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DepositLimitsAllOfAttributesAch; +import org.openapitools.client.model.DepositLimitsAllOfAttributesCard; +import org.openapitools.client.model.DepositLimitsAllOfAttributesCheckDeposit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributes { + public static final String SERIALIZED_NAME_ACH = "ach"; + @SerializedName(SERIALIZED_NAME_ACH) + private DepositLimitsAllOfAttributesAch ach; + + public static final String SERIALIZED_NAME_CARD = "card"; + @SerializedName(SERIALIZED_NAME_CARD) + private DepositLimitsAllOfAttributesCard card; + + public static final String SERIALIZED_NAME_CHECK_DEPOSIT = "checkDeposit"; + @SerializedName(SERIALIZED_NAME_CHECK_DEPOSIT) + private DepositLimitsAllOfAttributesCheckDeposit checkDeposit; + + public DepositLimitsAllOfAttributes() { + } + + public DepositLimitsAllOfAttributes ach(DepositLimitsAllOfAttributesAch ach) { + + this.ach = ach; + return this; + } + + /** + * Get ach + * @return ach + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesAch getAch() { + return ach; + } + + + public void setAch(DepositLimitsAllOfAttributesAch ach) { + this.ach = ach; + } + + + public DepositLimitsAllOfAttributes card(DepositLimitsAllOfAttributesCard card) { + + this.card = card; + return this; + } + + /** + * Get card + * @return card + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesCard getCard() { + return card; + } + + + public void setCard(DepositLimitsAllOfAttributesCard card) { + this.card = card; + } + + + public DepositLimitsAllOfAttributes checkDeposit(DepositLimitsAllOfAttributesCheckDeposit checkDeposit) { + + this.checkDeposit = checkDeposit; + return this; + } + + /** + * Get checkDeposit + * @return checkDeposit + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesCheckDeposit getCheckDeposit() { + return checkDeposit; + } + + + public void setCheckDeposit(DepositLimitsAllOfAttributesCheckDeposit checkDeposit) { + this.checkDeposit = checkDeposit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributes depositLimitsAllOfAttributes = (DepositLimitsAllOfAttributes) o; + return Objects.equals(this.ach, depositLimitsAllOfAttributes.ach) && + Objects.equals(this.card, depositLimitsAllOfAttributes.card) && + Objects.equals(this.checkDeposit, depositLimitsAllOfAttributes.checkDeposit); + } + + @Override + public int hashCode() { + return Objects.hash(ach, card, checkDeposit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributes {\n"); + sb.append(" ach: ").append(toIndentedString(ach)).append("\n"); + sb.append(" card: ").append(toIndentedString(card)).append("\n"); + sb.append(" checkDeposit: ").append(toIndentedString(checkDeposit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ach"); + openapiFields.add("card"); + openapiFields.add("checkDeposit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("ach"); + openapiRequiredFields.add("card"); + openapiRequiredFields.add("checkDeposit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributes is not found in the empty JSON string", DepositLimitsAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `ach` + DepositLimitsAllOfAttributesAch.validateJsonElement(jsonObj.get("ach")); + // validate the required field `card` + DepositLimitsAllOfAttributesCard.validateJsonElement(jsonObj.get("card")); + // validate the required field `checkDeposit` + DepositLimitsAllOfAttributesCheckDeposit.validateJsonElement(jsonObj.get("checkDeposit")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributes + */ + public static DepositLimitsAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributes.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAch.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAch.java new file mode 100644 index 00000000..fdfcad15 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAch.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DepositLimitsAllOfAttributesAchLimits; +import org.openapitools.client.model.DepositLimitsAllOfAttributesAchTotalsDaily; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesAch + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesAch { + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private DepositLimitsAllOfAttributesAchLimits limits; + + public static final String SERIALIZED_NAME_TOTALS_DAILY = "totalsDaily"; + @SerializedName(SERIALIZED_NAME_TOTALS_DAILY) + private DepositLimitsAllOfAttributesAchTotalsDaily totalsDaily; + + public static final String SERIALIZED_NAME_TOTALS_MONTHLY = "totalsMonthly"; + @SerializedName(SERIALIZED_NAME_TOTALS_MONTHLY) + private DepositLimitsAllOfAttributesAchTotalsDaily totalsMonthly; + + public DepositLimitsAllOfAttributesAch() { + } + + public DepositLimitsAllOfAttributesAch limits(DepositLimitsAllOfAttributesAchLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesAchLimits getLimits() { + return limits; + } + + + public void setLimits(DepositLimitsAllOfAttributesAchLimits limits) { + this.limits = limits; + } + + + public DepositLimitsAllOfAttributesAch totalsDaily(DepositLimitsAllOfAttributesAchTotalsDaily totalsDaily) { + + this.totalsDaily = totalsDaily; + return this; + } + + /** + * Get totalsDaily + * @return totalsDaily + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesAchTotalsDaily getTotalsDaily() { + return totalsDaily; + } + + + public void setTotalsDaily(DepositLimitsAllOfAttributesAchTotalsDaily totalsDaily) { + this.totalsDaily = totalsDaily; + } + + + public DepositLimitsAllOfAttributesAch totalsMonthly(DepositLimitsAllOfAttributesAchTotalsDaily totalsMonthly) { + + this.totalsMonthly = totalsMonthly; + return this; + } + + /** + * Get totalsMonthly + * @return totalsMonthly + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesAchTotalsDaily getTotalsMonthly() { + return totalsMonthly; + } + + + public void setTotalsMonthly(DepositLimitsAllOfAttributesAchTotalsDaily totalsMonthly) { + this.totalsMonthly = totalsMonthly; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesAch depositLimitsAllOfAttributesAch = (DepositLimitsAllOfAttributesAch) o; + return Objects.equals(this.limits, depositLimitsAllOfAttributesAch.limits) && + Objects.equals(this.totalsDaily, depositLimitsAllOfAttributesAch.totalsDaily) && + Objects.equals(this.totalsMonthly, depositLimitsAllOfAttributesAch.totalsMonthly); + } + + @Override + public int hashCode() { + return Objects.hash(limits, totalsDaily, totalsMonthly); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesAch {\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" totalsDaily: ").append(toIndentedString(totalsDaily)).append("\n"); + sb.append(" totalsMonthly: ").append(toIndentedString(totalsMonthly)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limits"); + openapiFields.add("totalsDaily"); + openapiFields.add("totalsMonthly"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("limits"); + openapiRequiredFields.add("totalsDaily"); + openapiRequiredFields.add("totalsMonthly"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesAch + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesAch.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesAch is not found in the empty JSON string", DepositLimitsAllOfAttributesAch.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesAch.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesAch` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesAch.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `limits` + DepositLimitsAllOfAttributesAchLimits.validateJsonElement(jsonObj.get("limits")); + // validate the required field `totalsDaily` + DepositLimitsAllOfAttributesAchTotalsDaily.validateJsonElement(jsonObj.get("totalsDaily")); + // validate the required field `totalsMonthly` + DepositLimitsAllOfAttributesAchTotalsDaily.validateJsonElement(jsonObj.get("totalsMonthly")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesAch.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesAch' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesAch.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesAch value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesAch read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesAch given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesAch + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesAch + */ + public static DepositLimitsAllOfAttributesAch fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesAch.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesAch to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAchLimits.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAchLimits.java new file mode 100644 index 00000000..c8a11b37 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAchLimits.java @@ -0,0 +1,357 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesAchLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesAchLimits { + public static final String SERIALIZED_NAME_DAILY_DEBIT = "dailyDebit"; + @SerializedName(SERIALIZED_NAME_DAILY_DEBIT) + private BigDecimal dailyDebit; + + public static final String SERIALIZED_NAME_DAILY_CREDIT = "dailyCredit"; + @SerializedName(SERIALIZED_NAME_DAILY_CREDIT) + private BigDecimal dailyCredit; + + public static final String SERIALIZED_NAME_MONTHLY_DEBIT = "monthlyDebit"; + @SerializedName(SERIALIZED_NAME_MONTHLY_DEBIT) + private BigDecimal monthlyDebit; + + public static final String SERIALIZED_NAME_MONTHLY_DEBIT_SOFT = "monthlyDebitSoft"; + @SerializedName(SERIALIZED_NAME_MONTHLY_DEBIT_SOFT) + private BigDecimal monthlyDebitSoft; + + public static final String SERIALIZED_NAME_DAILY_DEBIT_SOFT = "dailyDebitSoft"; + @SerializedName(SERIALIZED_NAME_DAILY_DEBIT_SOFT) + private BigDecimal dailyDebitSoft; + + public static final String SERIALIZED_NAME_MONTHLY_CREDIT = "monthlyCredit"; + @SerializedName(SERIALIZED_NAME_MONTHLY_CREDIT) + private BigDecimal monthlyCredit; + + public DepositLimitsAllOfAttributesAchLimits() { + } + + public DepositLimitsAllOfAttributesAchLimits dailyDebit(BigDecimal dailyDebit) { + + this.dailyDebit = dailyDebit; + return this; + } + + /** + * Get dailyDebit + * @return dailyDebit + **/ + @javax.annotation.Nonnull + public BigDecimal getDailyDebit() { + return dailyDebit; + } + + + public void setDailyDebit(BigDecimal dailyDebit) { + this.dailyDebit = dailyDebit; + } + + + public DepositLimitsAllOfAttributesAchLimits dailyCredit(BigDecimal dailyCredit) { + + this.dailyCredit = dailyCredit; + return this; + } + + /** + * Get dailyCredit + * @return dailyCredit + **/ + @javax.annotation.Nonnull + public BigDecimal getDailyCredit() { + return dailyCredit; + } + + + public void setDailyCredit(BigDecimal dailyCredit) { + this.dailyCredit = dailyCredit; + } + + + public DepositLimitsAllOfAttributesAchLimits monthlyDebit(BigDecimal monthlyDebit) { + + this.monthlyDebit = monthlyDebit; + return this; + } + + /** + * Get monthlyDebit + * @return monthlyDebit + **/ + @javax.annotation.Nonnull + public BigDecimal getMonthlyDebit() { + return monthlyDebit; + } + + + public void setMonthlyDebit(BigDecimal monthlyDebit) { + this.monthlyDebit = monthlyDebit; + } + + + public DepositLimitsAllOfAttributesAchLimits monthlyDebitSoft(BigDecimal monthlyDebitSoft) { + + this.monthlyDebitSoft = monthlyDebitSoft; + return this; + } + + /** + * Get monthlyDebitSoft + * @return monthlyDebitSoft + **/ + @javax.annotation.Nullable + public BigDecimal getMonthlyDebitSoft() { + return monthlyDebitSoft; + } + + + public void setMonthlyDebitSoft(BigDecimal monthlyDebitSoft) { + this.monthlyDebitSoft = monthlyDebitSoft; + } + + + public DepositLimitsAllOfAttributesAchLimits dailyDebitSoft(BigDecimal dailyDebitSoft) { + + this.dailyDebitSoft = dailyDebitSoft; + return this; + } + + /** + * Get dailyDebitSoft + * @return dailyDebitSoft + **/ + @javax.annotation.Nullable + public BigDecimal getDailyDebitSoft() { + return dailyDebitSoft; + } + + + public void setDailyDebitSoft(BigDecimal dailyDebitSoft) { + this.dailyDebitSoft = dailyDebitSoft; + } + + + public DepositLimitsAllOfAttributesAchLimits monthlyCredit(BigDecimal monthlyCredit) { + + this.monthlyCredit = monthlyCredit; + return this; + } + + /** + * Get monthlyCredit + * @return monthlyCredit + **/ + @javax.annotation.Nonnull + public BigDecimal getMonthlyCredit() { + return monthlyCredit; + } + + + public void setMonthlyCredit(BigDecimal monthlyCredit) { + this.monthlyCredit = monthlyCredit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesAchLimits depositLimitsAllOfAttributesAchLimits = (DepositLimitsAllOfAttributesAchLimits) o; + return Objects.equals(this.dailyDebit, depositLimitsAllOfAttributesAchLimits.dailyDebit) && + Objects.equals(this.dailyCredit, depositLimitsAllOfAttributesAchLimits.dailyCredit) && + Objects.equals(this.monthlyDebit, depositLimitsAllOfAttributesAchLimits.monthlyDebit) && + Objects.equals(this.monthlyDebitSoft, depositLimitsAllOfAttributesAchLimits.monthlyDebitSoft) && + Objects.equals(this.dailyDebitSoft, depositLimitsAllOfAttributesAchLimits.dailyDebitSoft) && + Objects.equals(this.monthlyCredit, depositLimitsAllOfAttributesAchLimits.monthlyCredit); + } + + @Override + public int hashCode() { + return Objects.hash(dailyDebit, dailyCredit, monthlyDebit, monthlyDebitSoft, dailyDebitSoft, monthlyCredit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesAchLimits {\n"); + sb.append(" dailyDebit: ").append(toIndentedString(dailyDebit)).append("\n"); + sb.append(" dailyCredit: ").append(toIndentedString(dailyCredit)).append("\n"); + sb.append(" monthlyDebit: ").append(toIndentedString(monthlyDebit)).append("\n"); + sb.append(" monthlyDebitSoft: ").append(toIndentedString(monthlyDebitSoft)).append("\n"); + sb.append(" dailyDebitSoft: ").append(toIndentedString(dailyDebitSoft)).append("\n"); + sb.append(" monthlyCredit: ").append(toIndentedString(monthlyCredit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyDebit"); + openapiFields.add("dailyCredit"); + openapiFields.add("monthlyDebit"); + openapiFields.add("monthlyDebitSoft"); + openapiFields.add("dailyDebitSoft"); + openapiFields.add("monthlyCredit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dailyDebit"); + openapiRequiredFields.add("dailyCredit"); + openapiRequiredFields.add("monthlyDebit"); + openapiRequiredFields.add("monthlyCredit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesAchLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesAchLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesAchLimits is not found in the empty JSON string", DepositLimitsAllOfAttributesAchLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesAchLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesAchLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesAchLimits.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesAchLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesAchLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesAchLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesAchLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesAchLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesAchLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesAchLimits + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesAchLimits + */ + public static DepositLimitsAllOfAttributesAchLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesAchLimits.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesAchLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAchTotalsDaily.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAchTotalsDaily.java new file mode 100644 index 00000000..06529a08 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesAchTotalsDaily.java @@ -0,0 +1,243 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesAchTotalsDaily + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesAchTotalsDaily { + public static final String SERIALIZED_NAME_DEBITS = "debits"; + @SerializedName(SERIALIZED_NAME_DEBITS) + private BigDecimal debits; + + public static final String SERIALIZED_NAME_CREDITS = "credits"; + @SerializedName(SERIALIZED_NAME_CREDITS) + private BigDecimal credits; + + public DepositLimitsAllOfAttributesAchTotalsDaily() { + } + + public DepositLimitsAllOfAttributesAchTotalsDaily debits(BigDecimal debits) { + + this.debits = debits; + return this; + } + + /** + * Get debits + * @return debits + **/ + @javax.annotation.Nonnull + public BigDecimal getDebits() { + return debits; + } + + + public void setDebits(BigDecimal debits) { + this.debits = debits; + } + + + public DepositLimitsAllOfAttributesAchTotalsDaily credits(BigDecimal credits) { + + this.credits = credits; + return this; + } + + /** + * Get credits + * @return credits + **/ + @javax.annotation.Nonnull + public BigDecimal getCredits() { + return credits; + } + + + public void setCredits(BigDecimal credits) { + this.credits = credits; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesAchTotalsDaily depositLimitsAllOfAttributesAchTotalsDaily = (DepositLimitsAllOfAttributesAchTotalsDaily) o; + return Objects.equals(this.debits, depositLimitsAllOfAttributesAchTotalsDaily.debits) && + Objects.equals(this.credits, depositLimitsAllOfAttributesAchTotalsDaily.credits); + } + + @Override + public int hashCode() { + return Objects.hash(debits, credits); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesAchTotalsDaily {\n"); + sb.append(" debits: ").append(toIndentedString(debits)).append("\n"); + sb.append(" credits: ").append(toIndentedString(credits)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("debits"); + openapiFields.add("credits"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("debits"); + openapiRequiredFields.add("credits"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesAchTotalsDaily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesAchTotalsDaily.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesAchTotalsDaily is not found in the empty JSON string", DepositLimitsAllOfAttributesAchTotalsDaily.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesAchTotalsDaily.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesAchTotalsDaily` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesAchTotalsDaily.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesAchTotalsDaily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesAchTotalsDaily' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesAchTotalsDaily.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesAchTotalsDaily value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesAchTotalsDaily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesAchTotalsDaily given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesAchTotalsDaily + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesAchTotalsDaily + */ + public static DepositLimitsAllOfAttributesAchTotalsDaily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesAchTotalsDaily.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesAchTotalsDaily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCard.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCard.java new file mode 100644 index 00000000..2bcd68b4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCard.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DepositLimitsAllOfAttributesCardLimits; +import org.openapitools.client.model.DepositLimitsAllOfAttributesCardTotalsDaily; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesCard { + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private DepositLimitsAllOfAttributesCardLimits limits; + + public static final String SERIALIZED_NAME_TOTALS_DAILY = "totalsDaily"; + @SerializedName(SERIALIZED_NAME_TOTALS_DAILY) + private DepositLimitsAllOfAttributesCardTotalsDaily totalsDaily; + + public DepositLimitsAllOfAttributesCard() { + } + + public DepositLimitsAllOfAttributesCard limits(DepositLimitsAllOfAttributesCardLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesCardLimits getLimits() { + return limits; + } + + + public void setLimits(DepositLimitsAllOfAttributesCardLimits limits) { + this.limits = limits; + } + + + public DepositLimitsAllOfAttributesCard totalsDaily(DepositLimitsAllOfAttributesCardTotalsDaily totalsDaily) { + + this.totalsDaily = totalsDaily; + return this; + } + + /** + * Get totalsDaily + * @return totalsDaily + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesCardTotalsDaily getTotalsDaily() { + return totalsDaily; + } + + + public void setTotalsDaily(DepositLimitsAllOfAttributesCardTotalsDaily totalsDaily) { + this.totalsDaily = totalsDaily; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesCard depositLimitsAllOfAttributesCard = (DepositLimitsAllOfAttributesCard) o; + return Objects.equals(this.limits, depositLimitsAllOfAttributesCard.limits) && + Objects.equals(this.totalsDaily, depositLimitsAllOfAttributesCard.totalsDaily); + } + + @Override + public int hashCode() { + return Objects.hash(limits, totalsDaily); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesCard {\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" totalsDaily: ").append(toIndentedString(totalsDaily)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limits"); + openapiFields.add("totalsDaily"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("limits"); + openapiRequiredFields.add("totalsDaily"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesCard is not found in the empty JSON string", DepositLimitsAllOfAttributesCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `limits` + DepositLimitsAllOfAttributesCardLimits.validateJsonElement(jsonObj.get("limits")); + // validate the required field `totalsDaily` + DepositLimitsAllOfAttributesCardTotalsDaily.validateJsonElement(jsonObj.get("totalsDaily")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesCard + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesCard + */ + public static DepositLimitsAllOfAttributesCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesCard.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCardLimits.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCardLimits.java new file mode 100644 index 00000000..96352c42 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCardLimits.java @@ -0,0 +1,301 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesCardLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesCardLimits { + public static final String SERIALIZED_NAME_DAILY_WITHDRAWAL = "dailyWithdrawal"; + @SerializedName(SERIALIZED_NAME_DAILY_WITHDRAWAL) + private BigDecimal dailyWithdrawal; + + public static final String SERIALIZED_NAME_DAILY_DEPOSIT = "dailyDeposit"; + @SerializedName(SERIALIZED_NAME_DAILY_DEPOSIT) + private BigDecimal dailyDeposit; + + public static final String SERIALIZED_NAME_DAILY_PURCHASE = "dailyPurchase"; + @SerializedName(SERIALIZED_NAME_DAILY_PURCHASE) + private BigDecimal dailyPurchase; + + public static final String SERIALIZED_NAME_DAILY_CARD_TRANSACTION = "dailyCardTransaction"; + @SerializedName(SERIALIZED_NAME_DAILY_CARD_TRANSACTION) + private BigDecimal dailyCardTransaction; + + public DepositLimitsAllOfAttributesCardLimits() { + } + + public DepositLimitsAllOfAttributesCardLimits dailyWithdrawal(BigDecimal dailyWithdrawal) { + + this.dailyWithdrawal = dailyWithdrawal; + return this; + } + + /** + * Get dailyWithdrawal + * @return dailyWithdrawal + **/ + @javax.annotation.Nonnull + public BigDecimal getDailyWithdrawal() { + return dailyWithdrawal; + } + + + public void setDailyWithdrawal(BigDecimal dailyWithdrawal) { + this.dailyWithdrawal = dailyWithdrawal; + } + + + public DepositLimitsAllOfAttributesCardLimits dailyDeposit(BigDecimal dailyDeposit) { + + this.dailyDeposit = dailyDeposit; + return this; + } + + /** + * Get dailyDeposit + * @return dailyDeposit + **/ + @javax.annotation.Nonnull + public BigDecimal getDailyDeposit() { + return dailyDeposit; + } + + + public void setDailyDeposit(BigDecimal dailyDeposit) { + this.dailyDeposit = dailyDeposit; + } + + + public DepositLimitsAllOfAttributesCardLimits dailyPurchase(BigDecimal dailyPurchase) { + + this.dailyPurchase = dailyPurchase; + return this; + } + + /** + * Get dailyPurchase + * @return dailyPurchase + **/ + @javax.annotation.Nonnull + public BigDecimal getDailyPurchase() { + return dailyPurchase; + } + + + public void setDailyPurchase(BigDecimal dailyPurchase) { + this.dailyPurchase = dailyPurchase; + } + + + public DepositLimitsAllOfAttributesCardLimits dailyCardTransaction(BigDecimal dailyCardTransaction) { + + this.dailyCardTransaction = dailyCardTransaction; + return this; + } + + /** + * Get dailyCardTransaction + * @return dailyCardTransaction + **/ + @javax.annotation.Nonnull + public BigDecimal getDailyCardTransaction() { + return dailyCardTransaction; + } + + + public void setDailyCardTransaction(BigDecimal dailyCardTransaction) { + this.dailyCardTransaction = dailyCardTransaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesCardLimits depositLimitsAllOfAttributesCardLimits = (DepositLimitsAllOfAttributesCardLimits) o; + return Objects.equals(this.dailyWithdrawal, depositLimitsAllOfAttributesCardLimits.dailyWithdrawal) && + Objects.equals(this.dailyDeposit, depositLimitsAllOfAttributesCardLimits.dailyDeposit) && + Objects.equals(this.dailyPurchase, depositLimitsAllOfAttributesCardLimits.dailyPurchase) && + Objects.equals(this.dailyCardTransaction, depositLimitsAllOfAttributesCardLimits.dailyCardTransaction); + } + + @Override + public int hashCode() { + return Objects.hash(dailyWithdrawal, dailyDeposit, dailyPurchase, dailyCardTransaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesCardLimits {\n"); + sb.append(" dailyWithdrawal: ").append(toIndentedString(dailyWithdrawal)).append("\n"); + sb.append(" dailyDeposit: ").append(toIndentedString(dailyDeposit)).append("\n"); + sb.append(" dailyPurchase: ").append(toIndentedString(dailyPurchase)).append("\n"); + sb.append(" dailyCardTransaction: ").append(toIndentedString(dailyCardTransaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyWithdrawal"); + openapiFields.add("dailyDeposit"); + openapiFields.add("dailyPurchase"); + openapiFields.add("dailyCardTransaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dailyWithdrawal"); + openapiRequiredFields.add("dailyDeposit"); + openapiRequiredFields.add("dailyPurchase"); + openapiRequiredFields.add("dailyCardTransaction"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesCardLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesCardLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesCardLimits is not found in the empty JSON string", DepositLimitsAllOfAttributesCardLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesCardLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesCardLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesCardLimits.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesCardLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesCardLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesCardLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesCardLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesCardLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesCardLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesCardLimits + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesCardLimits + */ + public static DepositLimitsAllOfAttributesCardLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesCardLimits.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesCardLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCardTotalsDaily.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCardTotalsDaily.java new file mode 100644 index 00000000..c49a6c75 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCardTotalsDaily.java @@ -0,0 +1,301 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesCardTotalsDaily + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesCardTotalsDaily { + public static final String SERIALIZED_NAME_WITHDRAWALS = "withdrawals"; + @SerializedName(SERIALIZED_NAME_WITHDRAWALS) + private BigDecimal withdrawals; + + public static final String SERIALIZED_NAME_DEPOSITS = "deposits"; + @SerializedName(SERIALIZED_NAME_DEPOSITS) + private BigDecimal deposits; + + public static final String SERIALIZED_NAME_PURCHASES = "purchases"; + @SerializedName(SERIALIZED_NAME_PURCHASES) + private BigDecimal purchases; + + public static final String SERIALIZED_NAME_CARD_TRANSACTIONS = "cardTransactions"; + @SerializedName(SERIALIZED_NAME_CARD_TRANSACTIONS) + private BigDecimal cardTransactions; + + public DepositLimitsAllOfAttributesCardTotalsDaily() { + } + + public DepositLimitsAllOfAttributesCardTotalsDaily withdrawals(BigDecimal withdrawals) { + + this.withdrawals = withdrawals; + return this; + } + + /** + * Get withdrawals + * @return withdrawals + **/ + @javax.annotation.Nonnull + public BigDecimal getWithdrawals() { + return withdrawals; + } + + + public void setWithdrawals(BigDecimal withdrawals) { + this.withdrawals = withdrawals; + } + + + public DepositLimitsAllOfAttributesCardTotalsDaily deposits(BigDecimal deposits) { + + this.deposits = deposits; + return this; + } + + /** + * Get deposits + * @return deposits + **/ + @javax.annotation.Nonnull + public BigDecimal getDeposits() { + return deposits; + } + + + public void setDeposits(BigDecimal deposits) { + this.deposits = deposits; + } + + + public DepositLimitsAllOfAttributesCardTotalsDaily purchases(BigDecimal purchases) { + + this.purchases = purchases; + return this; + } + + /** + * Get purchases + * @return purchases + **/ + @javax.annotation.Nonnull + public BigDecimal getPurchases() { + return purchases; + } + + + public void setPurchases(BigDecimal purchases) { + this.purchases = purchases; + } + + + public DepositLimitsAllOfAttributesCardTotalsDaily cardTransactions(BigDecimal cardTransactions) { + + this.cardTransactions = cardTransactions; + return this; + } + + /** + * Get cardTransactions + * @return cardTransactions + **/ + @javax.annotation.Nonnull + public BigDecimal getCardTransactions() { + return cardTransactions; + } + + + public void setCardTransactions(BigDecimal cardTransactions) { + this.cardTransactions = cardTransactions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesCardTotalsDaily depositLimitsAllOfAttributesCardTotalsDaily = (DepositLimitsAllOfAttributesCardTotalsDaily) o; + return Objects.equals(this.withdrawals, depositLimitsAllOfAttributesCardTotalsDaily.withdrawals) && + Objects.equals(this.deposits, depositLimitsAllOfAttributesCardTotalsDaily.deposits) && + Objects.equals(this.purchases, depositLimitsAllOfAttributesCardTotalsDaily.purchases) && + Objects.equals(this.cardTransactions, depositLimitsAllOfAttributesCardTotalsDaily.cardTransactions); + } + + @Override + public int hashCode() { + return Objects.hash(withdrawals, deposits, purchases, cardTransactions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesCardTotalsDaily {\n"); + sb.append(" withdrawals: ").append(toIndentedString(withdrawals)).append("\n"); + sb.append(" deposits: ").append(toIndentedString(deposits)).append("\n"); + sb.append(" purchases: ").append(toIndentedString(purchases)).append("\n"); + sb.append(" cardTransactions: ").append(toIndentedString(cardTransactions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("withdrawals"); + openapiFields.add("deposits"); + openapiFields.add("purchases"); + openapiFields.add("cardTransactions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("withdrawals"); + openapiRequiredFields.add("deposits"); + openapiRequiredFields.add("purchases"); + openapiRequiredFields.add("cardTransactions"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesCardTotalsDaily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesCardTotalsDaily.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesCardTotalsDaily is not found in the empty JSON string", DepositLimitsAllOfAttributesCardTotalsDaily.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesCardTotalsDaily.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesCardTotalsDaily` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesCardTotalsDaily.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesCardTotalsDaily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesCardTotalsDaily' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesCardTotalsDaily.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesCardTotalsDaily value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesCardTotalsDaily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesCardTotalsDaily given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesCardTotalsDaily + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesCardTotalsDaily + */ + public static DepositLimitsAllOfAttributesCardTotalsDaily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesCardTotalsDaily.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesCardTotalsDaily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCheckDeposit.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCheckDeposit.java new file mode 100644 index 00000000..f6d516d1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCheckDeposit.java @@ -0,0 +1,275 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import org.openapitools.client.model.DepositLimitsAllOfAttributesCheckDepositLimits; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesCheckDeposit + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesCheckDeposit { + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private DepositLimitsAllOfAttributesCheckDepositLimits limits; + + public static final String SERIALIZED_NAME_TOTALS_DAILY = "totalsDaily"; + @SerializedName(SERIALIZED_NAME_TOTALS_DAILY) + private BigDecimal totalsDaily; + + public static final String SERIALIZED_NAME_TOTALS_MONTHLY = "totalsMonthly"; + @SerializedName(SERIALIZED_NAME_TOTALS_MONTHLY) + private BigDecimal totalsMonthly; + + public DepositLimitsAllOfAttributesCheckDeposit() { + } + + public DepositLimitsAllOfAttributesCheckDeposit limits(DepositLimitsAllOfAttributesCheckDepositLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nonnull + public DepositLimitsAllOfAttributesCheckDepositLimits getLimits() { + return limits; + } + + + public void setLimits(DepositLimitsAllOfAttributesCheckDepositLimits limits) { + this.limits = limits; + } + + + public DepositLimitsAllOfAttributesCheckDeposit totalsDaily(BigDecimal totalsDaily) { + + this.totalsDaily = totalsDaily; + return this; + } + + /** + * Get totalsDaily + * @return totalsDaily + **/ + @javax.annotation.Nonnull + public BigDecimal getTotalsDaily() { + return totalsDaily; + } + + + public void setTotalsDaily(BigDecimal totalsDaily) { + this.totalsDaily = totalsDaily; + } + + + public DepositLimitsAllOfAttributesCheckDeposit totalsMonthly(BigDecimal totalsMonthly) { + + this.totalsMonthly = totalsMonthly; + return this; + } + + /** + * Get totalsMonthly + * @return totalsMonthly + **/ + @javax.annotation.Nonnull + public BigDecimal getTotalsMonthly() { + return totalsMonthly; + } + + + public void setTotalsMonthly(BigDecimal totalsMonthly) { + this.totalsMonthly = totalsMonthly; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesCheckDeposit depositLimitsAllOfAttributesCheckDeposit = (DepositLimitsAllOfAttributesCheckDeposit) o; + return Objects.equals(this.limits, depositLimitsAllOfAttributesCheckDeposit.limits) && + Objects.equals(this.totalsDaily, depositLimitsAllOfAttributesCheckDeposit.totalsDaily) && + Objects.equals(this.totalsMonthly, depositLimitsAllOfAttributesCheckDeposit.totalsMonthly); + } + + @Override + public int hashCode() { + return Objects.hash(limits, totalsDaily, totalsMonthly); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesCheckDeposit {\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" totalsDaily: ").append(toIndentedString(totalsDaily)).append("\n"); + sb.append(" totalsMonthly: ").append(toIndentedString(totalsMonthly)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limits"); + openapiFields.add("totalsDaily"); + openapiFields.add("totalsMonthly"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("limits"); + openapiRequiredFields.add("totalsDaily"); + openapiRequiredFields.add("totalsMonthly"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesCheckDeposit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesCheckDeposit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesCheckDeposit is not found in the empty JSON string", DepositLimitsAllOfAttributesCheckDeposit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesCheckDeposit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesCheckDeposit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesCheckDeposit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `limits` + DepositLimitsAllOfAttributesCheckDepositLimits.validateJsonElement(jsonObj.get("limits")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesCheckDeposit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesCheckDeposit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesCheckDeposit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesCheckDeposit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesCheckDeposit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesCheckDeposit given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesCheckDeposit + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesCheckDeposit + */ + public static DepositLimitsAllOfAttributesCheckDeposit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesCheckDeposit.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesCheckDeposit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCheckDepositLimits.java b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCheckDepositLimits.java new file mode 100644 index 00000000..d847d8be --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DepositLimitsAllOfAttributesCheckDepositLimits.java @@ -0,0 +1,301 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DepositLimitsAllOfAttributesCheckDepositLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DepositLimitsAllOfAttributesCheckDepositLimits { + public static final String SERIALIZED_NAME_DAILY = "daily"; + @SerializedName(SERIALIZED_NAME_DAILY) + private BigDecimal daily; + + public static final String SERIALIZED_NAME_MONTHLY = "monthly"; + @SerializedName(SERIALIZED_NAME_MONTHLY) + private BigDecimal monthly; + + public static final String SERIALIZED_NAME_DAILY_SOFT = "dailySoft"; + @SerializedName(SERIALIZED_NAME_DAILY_SOFT) + private BigDecimal dailySoft; + + public static final String SERIALIZED_NAME_MONTHLY_SOFT = "monthlySoft"; + @SerializedName(SERIALIZED_NAME_MONTHLY_SOFT) + private BigDecimal monthlySoft; + + public DepositLimitsAllOfAttributesCheckDepositLimits() { + } + + public DepositLimitsAllOfAttributesCheckDepositLimits daily(BigDecimal daily) { + + this.daily = daily; + return this; + } + + /** + * Get daily + * @return daily + **/ + @javax.annotation.Nonnull + public BigDecimal getDaily() { + return daily; + } + + + public void setDaily(BigDecimal daily) { + this.daily = daily; + } + + + public DepositLimitsAllOfAttributesCheckDepositLimits monthly(BigDecimal monthly) { + + this.monthly = monthly; + return this; + } + + /** + * Get monthly + * @return monthly + **/ + @javax.annotation.Nonnull + public BigDecimal getMonthly() { + return monthly; + } + + + public void setMonthly(BigDecimal monthly) { + this.monthly = monthly; + } + + + public DepositLimitsAllOfAttributesCheckDepositLimits dailySoft(BigDecimal dailySoft) { + + this.dailySoft = dailySoft; + return this; + } + + /** + * Get dailySoft + * @return dailySoft + **/ + @javax.annotation.Nonnull + public BigDecimal getDailySoft() { + return dailySoft; + } + + + public void setDailySoft(BigDecimal dailySoft) { + this.dailySoft = dailySoft; + } + + + public DepositLimitsAllOfAttributesCheckDepositLimits monthlySoft(BigDecimal monthlySoft) { + + this.monthlySoft = monthlySoft; + return this; + } + + /** + * Get monthlySoft + * @return monthlySoft + **/ + @javax.annotation.Nonnull + public BigDecimal getMonthlySoft() { + return monthlySoft; + } + + + public void setMonthlySoft(BigDecimal monthlySoft) { + this.monthlySoft = monthlySoft; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DepositLimitsAllOfAttributesCheckDepositLimits depositLimitsAllOfAttributesCheckDepositLimits = (DepositLimitsAllOfAttributesCheckDepositLimits) o; + return Objects.equals(this.daily, depositLimitsAllOfAttributesCheckDepositLimits.daily) && + Objects.equals(this.monthly, depositLimitsAllOfAttributesCheckDepositLimits.monthly) && + Objects.equals(this.dailySoft, depositLimitsAllOfAttributesCheckDepositLimits.dailySoft) && + Objects.equals(this.monthlySoft, depositLimitsAllOfAttributesCheckDepositLimits.monthlySoft); + } + + @Override + public int hashCode() { + return Objects.hash(daily, monthly, dailySoft, monthlySoft); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DepositLimitsAllOfAttributesCheckDepositLimits {\n"); + sb.append(" daily: ").append(toIndentedString(daily)).append("\n"); + sb.append(" monthly: ").append(toIndentedString(monthly)).append("\n"); + sb.append(" dailySoft: ").append(toIndentedString(dailySoft)).append("\n"); + sb.append(" monthlySoft: ").append(toIndentedString(monthlySoft)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("daily"); + openapiFields.add("monthly"); + openapiFields.add("dailySoft"); + openapiFields.add("monthlySoft"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("daily"); + openapiRequiredFields.add("monthly"); + openapiRequiredFields.add("dailySoft"); + openapiRequiredFields.add("monthlySoft"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DepositLimitsAllOfAttributesCheckDepositLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DepositLimitsAllOfAttributesCheckDepositLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DepositLimitsAllOfAttributesCheckDepositLimits is not found in the empty JSON string", DepositLimitsAllOfAttributesCheckDepositLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DepositLimitsAllOfAttributesCheckDepositLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DepositLimitsAllOfAttributesCheckDepositLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DepositLimitsAllOfAttributesCheckDepositLimits.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DepositLimitsAllOfAttributesCheckDepositLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DepositLimitsAllOfAttributesCheckDepositLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DepositLimitsAllOfAttributesCheckDepositLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DepositLimitsAllOfAttributesCheckDepositLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DepositLimitsAllOfAttributesCheckDepositLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DepositLimitsAllOfAttributesCheckDepositLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of DepositLimitsAllOfAttributesCheckDepositLimits + * @throws IOException if the JSON string is invalid with respect to DepositLimitsAllOfAttributesCheckDepositLimits + */ + public static DepositLimitsAllOfAttributesCheckDepositLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DepositLimitsAllOfAttributesCheckDepositLimits.class); + } + + /** + * Convert an instance of DepositLimitsAllOfAttributesCheckDepositLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DeviceFingerprint.java b/src/main/java/org/openapitools/client/model/DeviceFingerprint.java new file mode 100644 index 00000000..6500122d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DeviceFingerprint.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeviceFingerprint + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DeviceFingerprint { + /** + * Gets or Sets provider + */ + @JsonAdapter(ProviderEnum.Adapter.class) + public enum ProviderEnum { + IOVATION("iovation"); + + private String value; + + ProviderEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ProviderEnum fromValue(String value) { + for (ProviderEnum b : ProviderEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ProviderEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ProviderEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ProviderEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PROVIDER = "provider"; + @SerializedName(SERIALIZED_NAME_PROVIDER) + private ProviderEnum provider; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + public DeviceFingerprint() { + } + + public DeviceFingerprint provider(ProviderEnum provider) { + + this.provider = provider; + return this; + } + + /** + * Get provider + * @return provider + **/ + @javax.annotation.Nonnull + public ProviderEnum getProvider() { + return provider; + } + + + public void setProvider(ProviderEnum provider) { + this.provider = provider; + } + + + public DeviceFingerprint value(String value) { + + this.value = value; + return this; + } + + /** + * Get value + * @return value + **/ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + + public void setValue(String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeviceFingerprint deviceFingerprint = (DeviceFingerprint) o; + return Objects.equals(this.provider, deviceFingerprint.provider) && + Objects.equals(this.value, deviceFingerprint.value); + } + + @Override + public int hashCode() { + return Objects.hash(provider, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeviceFingerprint {\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("provider"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("provider"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeviceFingerprint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeviceFingerprint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeviceFingerprint is not found in the empty JSON string", DeviceFingerprint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeviceFingerprint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeviceFingerprint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeviceFingerprint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("provider").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `provider` to be a primitive type in the JSON string but got `%s`", jsonObj.get("provider").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeviceFingerprint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeviceFingerprint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeviceFingerprint.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeviceFingerprint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeviceFingerprint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeviceFingerprint given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeviceFingerprint + * @throws IOException if the JSON string is invalid with respect to DeviceFingerprint + */ + public static DeviceFingerprint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeviceFingerprint.class); + } + + /** + * Convert an instance of DeviceFingerprint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisableStopPaymentRequest.java b/src/main/java/org/openapitools/client/model/DisableStopPaymentRequest.java new file mode 100644 index 00000000..9f575110 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisableStopPaymentRequest.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisableStopPaymentRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisableStopPaymentRequest { + public static final String SERIALIZED_NAME_STOP_PAYMENT_ID = "stop_payment_id"; + @SerializedName(SERIALIZED_NAME_STOP_PAYMENT_ID) + private String stopPaymentId; + + public DisableStopPaymentRequest() { + } + + public DisableStopPaymentRequest stopPaymentId(String stopPaymentId) { + + this.stopPaymentId = stopPaymentId; + return this; + } + + /** + * Get stopPaymentId + * @return stopPaymentId + **/ + @javax.annotation.Nonnull + public String getStopPaymentId() { + return stopPaymentId; + } + + + public void setStopPaymentId(String stopPaymentId) { + this.stopPaymentId = stopPaymentId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisableStopPaymentRequest disableStopPaymentRequest = (DisableStopPaymentRequest) o; + return Objects.equals(this.stopPaymentId, disableStopPaymentRequest.stopPaymentId); + } + + @Override + public int hashCode() { + return Objects.hash(stopPaymentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisableStopPaymentRequest {\n"); + sb.append(" stopPaymentId: ").append(toIndentedString(stopPaymentId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("stop_payment_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("stop_payment_id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisableStopPaymentRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisableStopPaymentRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisableStopPaymentRequest is not found in the empty JSON string", DisableStopPaymentRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisableStopPaymentRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisableStopPaymentRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisableStopPaymentRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("stop_payment_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stop_payment_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stop_payment_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisableStopPaymentRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisableStopPaymentRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisableStopPaymentRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisableStopPaymentRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisableStopPaymentRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisableStopPaymentRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisableStopPaymentRequest + * @throws IOException if the JSON string is invalid with respect to DisableStopPaymentRequest + */ + public static DisableStopPaymentRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisableStopPaymentRequest.class); + } + + /** + * Convert an instance of DisableStopPaymentRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DishonoredAchTransaction.java b/src/main/java/org/openapitools/client/model/DishonoredAchTransaction.java new file mode 100644 index 00000000..5448f0c1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DishonoredAchTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DishonoredAchTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DishonoredAchTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DishonoredAchTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DishonoredAchTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public DishonoredAchTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public DishonoredAchTransaction attributes(DishonoredAchTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public DishonoredAchTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DishonoredAchTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public DishonoredAchTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DishonoredAchTransaction dishonoredAchTransaction = (DishonoredAchTransaction) o; + return Objects.equals(this.attributes, dishonoredAchTransaction.attributes) && + Objects.equals(this.relationships, dishonoredAchTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DishonoredAchTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DishonoredAchTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DishonoredAchTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DishonoredAchTransaction is not found in the empty JSON string", DishonoredAchTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DishonoredAchTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DishonoredAchTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DishonoredAchTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DishonoredAchTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DishonoredAchTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DishonoredAchTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DishonoredAchTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DishonoredAchTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DishonoredAchTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of DishonoredAchTransaction + * @throws IOException if the JSON string is invalid with respect to DishonoredAchTransaction + */ + public static DishonoredAchTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DishonoredAchTransaction.class); + } + + /** + * Convert an instance of DishonoredAchTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DishonoredAchTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/DishonoredAchTransactionAllOfAttributes.java new file mode 100644 index 00000000..1a066a32 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DishonoredAchTransactionAllOfAttributes.java @@ -0,0 +1,631 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DishonoredAchTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DishonoredAchTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + private String companyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_NAME = "counterpartyName"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_NAME) + private String counterpartyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER = "counterpartyRoutingNumber"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER) + private String counterpartyRoutingNumber; + + public static final String SERIALIZED_NAME_TRACE_NUMBER = "traceNumber"; + @SerializedName(SERIALIZED_NAME_TRACE_NUMBER) + private String traceNumber; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private String secCode; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public DishonoredAchTransactionAllOfAttributes() { + } + + public DishonoredAchTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public DishonoredAchTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public DishonoredAchTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public DishonoredAchTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public DishonoredAchTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public DishonoredAchTransactionAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public DishonoredAchTransactionAllOfAttributes companyName(String companyName) { + + this.companyName = companyName; + return this; + } + + /** + * Get companyName + * @return companyName + **/ + @javax.annotation.Nonnull + public String getCompanyName() { + return companyName; + } + + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + + public DishonoredAchTransactionAllOfAttributes counterpartyName(String counterpartyName) { + + this.counterpartyName = counterpartyName; + return this; + } + + /** + * Get counterpartyName + * @return counterpartyName + **/ + @javax.annotation.Nullable + public String getCounterpartyName() { + return counterpartyName; + } + + + public void setCounterpartyName(String counterpartyName) { + this.counterpartyName = counterpartyName; + } + + + public DishonoredAchTransactionAllOfAttributes counterpartyRoutingNumber(String counterpartyRoutingNumber) { + + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + return this; + } + + /** + * Get counterpartyRoutingNumber + * @return counterpartyRoutingNumber + **/ + @javax.annotation.Nonnull + public String getCounterpartyRoutingNumber() { + return counterpartyRoutingNumber; + } + + + public void setCounterpartyRoutingNumber(String counterpartyRoutingNumber) { + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + } + + + public DishonoredAchTransactionAllOfAttributes traceNumber(String traceNumber) { + + this.traceNumber = traceNumber; + return this; + } + + /** + * Get traceNumber + * @return traceNumber + **/ + @javax.annotation.Nullable + public String getTraceNumber() { + return traceNumber; + } + + + public void setTraceNumber(String traceNumber) { + this.traceNumber = traceNumber; + } + + + public DishonoredAchTransactionAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public DishonoredAchTransactionAllOfAttributes secCode(String secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public String getSecCode() { + return secCode; + } + + + public void setSecCode(String secCode) { + this.secCode = secCode; + } + + + public DishonoredAchTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DishonoredAchTransactionAllOfAttributes dishonoredAchTransactionAllOfAttributes = (DishonoredAchTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, dishonoredAchTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, dishonoredAchTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, dishonoredAchTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, dishonoredAchTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, dishonoredAchTransactionAllOfAttributes.summary) && + Objects.equals(this.description, dishonoredAchTransactionAllOfAttributes.description) && + Objects.equals(this.companyName, dishonoredAchTransactionAllOfAttributes.companyName) && + Objects.equals(this.counterpartyName, dishonoredAchTransactionAllOfAttributes.counterpartyName) && + Objects.equals(this.counterpartyRoutingNumber, dishonoredAchTransactionAllOfAttributes.counterpartyRoutingNumber) && + Objects.equals(this.traceNumber, dishonoredAchTransactionAllOfAttributes.traceNumber) && + Objects.equals(this.reason, dishonoredAchTransactionAllOfAttributes.reason) && + Objects.equals(this.secCode, dishonoredAchTransactionAllOfAttributes.secCode) && + Objects.equals(this.tags, dishonoredAchTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, description, companyName, counterpartyName, counterpartyRoutingNumber, traceNumber, reason, secCode, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DishonoredAchTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" counterpartyName: ").append(toIndentedString(counterpartyName)).append("\n"); + sb.append(" counterpartyRoutingNumber: ").append(toIndentedString(counterpartyRoutingNumber)).append("\n"); + sb.append(" traceNumber: ").append(toIndentedString(traceNumber)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("description"); + openapiFields.add("companyName"); + openapiFields.add("counterpartyName"); + openapiFields.add("counterpartyRoutingNumber"); + openapiFields.add("traceNumber"); + openapiFields.add("reason"); + openapiFields.add("secCode"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("companyName"); + openapiRequiredFields.add("counterpartyRoutingNumber"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DishonoredAchTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DishonoredAchTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DishonoredAchTransactionAllOfAttributes is not found in the empty JSON string", DishonoredAchTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DishonoredAchTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DishonoredAchTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DishonoredAchTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if ((jsonObj.get("counterpartyName") != null && !jsonObj.get("counterpartyName").isJsonNull()) && !jsonObj.get("counterpartyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyName").toString())); + } + if (!jsonObj.get("counterpartyRoutingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyRoutingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyRoutingNumber").toString())); + } + if ((jsonObj.get("traceNumber") != null && !jsonObj.get("traceNumber").isJsonNull()) && !jsonObj.get("traceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `traceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceNumber").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DishonoredAchTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DishonoredAchTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DishonoredAchTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DishonoredAchTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DishonoredAchTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DishonoredAchTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DishonoredAchTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to DishonoredAchTransactionAllOfAttributes + */ + public static DishonoredAchTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DishonoredAchTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of DishonoredAchTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Dispute.java b/src/main/java/org/openapitools/client/model/Dispute.java new file mode 100644 index 00000000..94cdd1c6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Dispute.java @@ -0,0 +1,313 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DisputeAttributes; +import org.openapitools.client.model.DisputeRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dispute + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Dispute { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "dispute"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DisputeAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private DisputeRelationships relationships; + + public Dispute() { + } + + public Dispute type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Dispute id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Dispute attributes(DisputeAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public DisputeAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DisputeAttributes attributes) { + this.attributes = attributes; + } + + + public Dispute relationships(DisputeRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public DisputeRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(DisputeRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dispute dispute = (Dispute) o; + return Objects.equals(this.type, dispute.type) && + Objects.equals(this.id, dispute.id) && + Objects.equals(this.attributes, dispute.attributes) && + Objects.equals(this.relationships, dispute.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dispute {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dispute + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dispute.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Dispute is not found in the empty JSON string", Dispute.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Dispute.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Dispute` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dispute.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + DisputeAttributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the required field `relationships` + DisputeRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dispute.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dispute' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dispute.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dispute value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Dispute read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dispute given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dispute + * @throws IOException if the JSON string is invalid with respect to Dispute + */ + public static Dispute fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dispute.class); + } + + /** + * Convert an instance of Dispute to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisputeAttributes.java b/src/main/java/org/openapitools/client/model/DisputeAttributes.java new file mode 100644 index 00000000..240060fa --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisputeAttributes.java @@ -0,0 +1,533 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DisputeAttributesStatusHistoryInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisputeAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisputeAttributes { + /** + * Gets or Sets source + */ + @JsonAdapter(SourceEnum.Adapter.class) + public enum SourceEnum { + DEBITCARD("DebitCard"), + + ACH("ACH"); + + private String value; + + SourceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceEnum fromValue(String value) { + for (SourceEnum b : SourceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SourceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + private SourceEnum source; + + public static final String SERIALIZED_NAME_EXTERNAL_ID = "externalId"; + @SerializedName(SERIALIZED_NAME_EXTERNAL_ID) + private String externalId; + + public static final String SERIALIZED_NAME_LINK = "link"; + @SerializedName(SERIALIZED_NAME_LINK) + private String link; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_STATUS_HISTORY = "statusHistory"; + @SerializedName(SERIALIZED_NAME_STATUS_HISTORY) + private List statusHistory; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DECISION_REASON = "decisionReason"; + @SerializedName(SERIALIZED_NAME_DECISION_REASON) + private String decisionReason; + + public DisputeAttributes() { + } + + public DisputeAttributes source(SourceEnum source) { + + this.source = source; + return this; + } + + /** + * Get source + * @return source + **/ + @javax.annotation.Nonnull + public SourceEnum getSource() { + return source; + } + + + public void setSource(SourceEnum source) { + this.source = source; + } + + + public DisputeAttributes externalId(String externalId) { + + this.externalId = externalId; + return this; + } + + /** + * Get externalId + * @return externalId + **/ + @javax.annotation.Nonnull + public String getExternalId() { + return externalId; + } + + + public void setExternalId(String externalId) { + this.externalId = externalId; + } + + + public DisputeAttributes link(String link) { + + this.link = link; + return this; + } + + /** + * Get link + * @return link + **/ + @javax.annotation.Nullable + public String getLink() { + return link; + } + + + public void setLink(String link) { + this.link = link; + } + + + public DisputeAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public DisputeAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public DisputeAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public DisputeAttributes statusHistory(List statusHistory) { + + this.statusHistory = statusHistory; + return this; + } + + public DisputeAttributes addStatusHistoryItem(DisputeAttributesStatusHistoryInner statusHistoryItem) { + if (this.statusHistory == null) { + this.statusHistory = new ArrayList<>(); + } + this.statusHistory.add(statusHistoryItem); + return this; + } + + /** + * Get statusHistory + * @return statusHistory + **/ + @javax.annotation.Nullable + public List getStatusHistory() { + return statusHistory; + } + + + public void setStatusHistory(List statusHistory) { + this.statusHistory = statusHistory; + } + + + public DisputeAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public DisputeAttributes decisionReason(String decisionReason) { + + this.decisionReason = decisionReason; + return this; + } + + /** + * Get decisionReason + * @return decisionReason + **/ + @javax.annotation.Nullable + public String getDecisionReason() { + return decisionReason; + } + + + public void setDecisionReason(String decisionReason) { + this.decisionReason = decisionReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeAttributes disputeAttributes = (DisputeAttributes) o; + return Objects.equals(this.source, disputeAttributes.source) && + Objects.equals(this.externalId, disputeAttributes.externalId) && + Objects.equals(this.link, disputeAttributes.link) && + Objects.equals(this.description, disputeAttributes.description) && + Objects.equals(this.amount, disputeAttributes.amount) && + Objects.equals(this.status, disputeAttributes.status) && + Objects.equals(this.statusHistory, disputeAttributes.statusHistory) && + Objects.equals(this.createdAt, disputeAttributes.createdAt) && + Objects.equals(this.decisionReason, disputeAttributes.decisionReason); + } + + @Override + public int hashCode() { + return Objects.hash(source, externalId, link, description, amount, status, statusHistory, createdAt, decisionReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeAttributes {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" statusHistory: ").append(toIndentedString(statusHistory)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" decisionReason: ").append(toIndentedString(decisionReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("source"); + openapiFields.add("externalId"); + openapiFields.add("link"); + openapiFields.add("description"); + openapiFields.add("amount"); + openapiFields.add("status"); + openapiFields.add("statusHistory"); + openapiFields.add("createdAt"); + openapiFields.add("decisionReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("source"); + openapiRequiredFields.add("externalId"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeAttributes is not found in the empty JSON string", DisputeAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + if (!jsonObj.get("externalId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `externalId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("externalId").toString())); + } + if ((jsonObj.get("link") != null && !jsonObj.get("link").isJsonNull()) && !jsonObj.get("link").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `link` to be a primitive type in the JSON string but got `%s`", jsonObj.get("link").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (jsonObj.get("statusHistory") != null && !jsonObj.get("statusHistory").isJsonNull()) { + JsonArray jsonArraystatusHistory = jsonObj.getAsJsonArray("statusHistory"); + if (jsonArraystatusHistory != null) { + // ensure the json data is an array + if (!jsonObj.get("statusHistory").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `statusHistory` to be an array in the JSON string but got `%s`", jsonObj.get("statusHistory").toString())); + } + + // validate the optional field `statusHistory` (array) + for (int i = 0; i < jsonArraystatusHistory.size(); i++) { + DisputeAttributesStatusHistoryInner.validateJsonElement(jsonArraystatusHistory.get(i)); + }; + } + } + if ((jsonObj.get("decisionReason") != null && !jsonObj.get("decisionReason").isJsonNull()) && !jsonObj.get("decisionReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeAttributes + * @throws IOException if the JSON string is invalid with respect to DisputeAttributes + */ + public static DisputeAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeAttributes.class); + } + + /** + * Convert an instance of DisputeAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisputeAttributesStatusHistoryInner.java b/src/main/java/org/openapitools/client/model/DisputeAttributesStatusHistoryInner.java new file mode 100644 index 00000000..b1681b12 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisputeAttributesStatusHistoryInner.java @@ -0,0 +1,237 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisputeAttributesStatusHistoryInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisputeAttributesStatusHistoryInner { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public DisputeAttributesStatusHistoryInner() { + } + + public DisputeAttributesStatusHistoryInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public DisputeAttributesStatusHistoryInner updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeAttributesStatusHistoryInner disputeAttributesStatusHistoryInner = (DisputeAttributesStatusHistoryInner) o; + return Objects.equals(this.type, disputeAttributesStatusHistoryInner.type) && + Objects.equals(this.updatedAt, disputeAttributesStatusHistoryInner.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(type, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeAttributesStatusHistoryInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeAttributesStatusHistoryInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeAttributesStatusHistoryInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeAttributesStatusHistoryInner is not found in the empty JSON string", DisputeAttributesStatusHistoryInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeAttributesStatusHistoryInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeAttributesStatusHistoryInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeAttributesStatusHistoryInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeAttributesStatusHistoryInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeAttributesStatusHistoryInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeAttributesStatusHistoryInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeAttributesStatusHistoryInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeAttributesStatusHistoryInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeAttributesStatusHistoryInner + * @throws IOException if the JSON string is invalid with respect to DisputeAttributesStatusHistoryInner + */ + public static DisputeAttributesStatusHistoryInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeAttributesStatusHistoryInner.class); + } + + /** + * Convert an instance of DisputeAttributesStatusHistoryInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisputeRelationships.java b/src/main/java/org/openapitools/client/model/DisputeRelationships.java new file mode 100644 index 00000000..29bc1ce7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisputeRelationships.java @@ -0,0 +1,278 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisputeRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisputeRelationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + @SerializedName(SERIALIZED_NAME_TRANSACTION) + private Relationship transaction; + + public DisputeRelationships() { + } + + public DisputeRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + public DisputeRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + public DisputeRelationships transaction(Relationship transaction) { + + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * @return transaction + **/ + @javax.annotation.Nonnull + public Relationship getTransaction() { + return transaction; + } + + + public void setTransaction(Relationship transaction) { + this.transaction = transaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeRelationships disputeRelationships = (DisputeRelationships) o; + return Objects.equals(this.customer, disputeRelationships.customer) && + Objects.equals(this.account, disputeRelationships.account) && + Objects.equals(this.transaction, disputeRelationships.transaction); + } + + @Override + public int hashCode() { + return Objects.hash(customer, account, transaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeRelationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + openapiFields.add("account"); + openapiFields.add("transaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("customer"); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("transaction"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeRelationships is not found in the empty JSON string", DisputeRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `customer` + Relationship.validateJsonElement(jsonObj.get("customer")); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + // validate the required field `transaction` + Relationship.validateJsonElement(jsonObj.get("transaction")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeRelationships + * @throws IOException if the JSON string is invalid with respect to DisputeRelationships + */ + public static DisputeRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeRelationships.class); + } + + /** + * Convert an instance of DisputeRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisputeSettlementTransaction.java b/src/main/java/org/openapitools/client/model/DisputeSettlementTransaction.java new file mode 100644 index 00000000..66bd5ced --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisputeSettlementTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisputeSettlementTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisputeSettlementTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public DisputeSettlementTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public DisputeSettlementTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public DisputeSettlementTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeSettlementTransaction disputeSettlementTransaction = (DisputeSettlementTransaction) o; + return Objects.equals(this.attributes, disputeSettlementTransaction.attributes) && + Objects.equals(this.relationships, disputeSettlementTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeSettlementTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeSettlementTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeSettlementTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeSettlementTransaction is not found in the empty JSON string", DisputeSettlementTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeSettlementTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeSettlementTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeSettlementTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeSettlementTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeSettlementTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeSettlementTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeSettlementTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeSettlementTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeSettlementTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeSettlementTransaction + * @throws IOException if the JSON string is invalid with respect to DisputeSettlementTransaction + */ + public static DisputeSettlementTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeSettlementTransaction.class); + } + + /** + * Convert an instance of DisputeSettlementTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisputeTransaction.java b/src/main/java/org/openapitools/client/model/DisputeTransaction.java new file mode 100644 index 00000000..70517cbc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisputeTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DisputeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisputeTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisputeTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DisputeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public DisputeTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public DisputeTransaction attributes(DisputeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public DisputeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DisputeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public DisputeTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeTransaction disputeTransaction = (DisputeTransaction) o; + return Objects.equals(this.attributes, disputeTransaction.attributes) && + Objects.equals(this.relationships, disputeTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeTransaction is not found in the empty JSON string", DisputeTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeTransaction + * @throws IOException if the JSON string is invalid with respect to DisputeTransaction + */ + public static DisputeTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeTransaction.class); + } + + /** + * Convert an instance of DisputeTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DisputeTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/DisputeTransactionAllOfAttributes.java new file mode 100644 index 00000000..f968a354 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DisputeTransactionAllOfAttributes.java @@ -0,0 +1,475 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DisputeTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DisputeTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_DISPUTE_ID = "disputeId"; + @SerializedName(SERIALIZED_NAME_DISPUTE_ID) + private String disputeId; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public DisputeTransactionAllOfAttributes() { + } + + public DisputeTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public DisputeTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public DisputeTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public DisputeTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public DisputeTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public DisputeTransactionAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nonnull + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public DisputeTransactionAllOfAttributes disputeId(String disputeId) { + + this.disputeId = disputeId; + return this; + } + + /** + * Get disputeId + * @return disputeId + **/ + @javax.annotation.Nonnull + public String getDisputeId() { + return disputeId; + } + + + public void setDisputeId(String disputeId) { + this.disputeId = disputeId; + } + + + public DisputeTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeTransactionAllOfAttributes disputeTransactionAllOfAttributes = (DisputeTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, disputeTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, disputeTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, disputeTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, disputeTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, disputeTransactionAllOfAttributes.summary) && + Objects.equals(this.reason, disputeTransactionAllOfAttributes.reason) && + Objects.equals(this.disputeId, disputeTransactionAllOfAttributes.disputeId) && + Objects.equals(this.tags, disputeTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, reason, disputeId, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" disputeId: ").append(toIndentedString(disputeId)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("reason"); + openapiFields.add("disputeId"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("reason"); + openapiRequiredFields.add("disputeId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeTransactionAllOfAttributes is not found in the empty JSON string", DisputeTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if (!jsonObj.get("disputeId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `disputeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disputeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to DisputeTransactionAllOfAttributes + */ + public static DisputeTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of DisputeTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Document.java b/src/main/java/org/openapitools/client/model/Document.java new file mode 100644 index 00000000..dfa810a8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Document.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DocumentAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Document + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Document { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "document"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private DocumentAttributes attributes; + + public Document() { + } + + public Document type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Document id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Document attributes(DocumentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public DocumentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(DocumentAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Document document = (Document) o; + return Objects.equals(this.type, document.type) && + Objects.equals(this.id, document.id) && + Objects.equals(this.attributes, document.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Document {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Document + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Document.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Document is not found in the empty JSON string", Document.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Document.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Document` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Document.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + DocumentAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Document.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Document' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Document.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Document value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Document read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Document given an JSON string + * + * @param jsonString JSON string + * @return An instance of Document + * @throws IOException if the JSON string is invalid with respect to Document + */ + public static Document fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Document.class); + } + + /** + * Convert an instance of Document to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DocumentAttributes.java b/src/main/java/org/openapitools/client/model/DocumentAttributes.java new file mode 100644 index 00000000..b21429a2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DocumentAttributes.java @@ -0,0 +1,802 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DocumentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DocumentAttributes { + public static final String SERIALIZED_NAME_DOCUMENT_TYPE = "documentType"; + @SerializedName(SERIALIZED_NAME_DOCUMENT_TYPE) + private String documentType; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_INCORPORATION = "dateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_DATE_OF_INCORPORATION) + private LocalDate dateOfIncorporation; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_REASON_CODE = "reasonCode"; + @SerializedName(SERIALIZED_NAME_REASON_CODE) + private String reasonCode; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_FRONT_DOCUMENT_ID = "frontDocumentId"; + @SerializedName(SERIALIZED_NAME_FRONT_DOCUMENT_ID) + private String frontDocumentId; + + public static final String SERIALIZED_NAME_BACK_DOCUMENT_ID = "backDocumentId"; + @SerializedName(SERIALIZED_NAME_BACK_DOCUMENT_ID) + private String backDocumentId; + + public static final String SERIALIZED_NAME_FRONT_DOCUMENT_STORE_ID = "frontDocumentStoreId"; + @SerializedName(SERIALIZED_NAME_FRONT_DOCUMENT_STORE_ID) + private String frontDocumentStoreId; + + public static final String SERIALIZED_NAME_BACK_DOCUMENT_STORE_ID = "backDocumentStoreId"; + @SerializedName(SERIALIZED_NAME_BACK_DOCUMENT_STORE_ID) + private String backDocumentStoreId; + + public DocumentAttributes() { + } + + public DocumentAttributes documentType(String documentType) { + + this.documentType = documentType; + return this; + } + + /** + * Get documentType + * @return documentType + **/ + @javax.annotation.Nullable + public String getDocumentType() { + return documentType; + } + + + public void setDocumentType(String documentType) { + this.documentType = documentType; + } + + + public DocumentAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public DocumentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public DocumentAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public DocumentAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public DocumentAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public DocumentAttributes matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public DocumentAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public DocumentAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public DocumentAttributes dateOfIncorporation(LocalDate dateOfIncorporation) { + + this.dateOfIncorporation = dateOfIncorporation; + return this; + } + + /** + * Get dateOfIncorporation + * @return dateOfIncorporation + **/ + @javax.annotation.Nullable + public LocalDate getDateOfIncorporation() { + return dateOfIncorporation; + } + + + public void setDateOfIncorporation(LocalDate dateOfIncorporation) { + this.dateOfIncorporation = dateOfIncorporation; + } + + + public DocumentAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nullable + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public DocumentAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public DocumentAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public DocumentAttributes reasonCode(String reasonCode) { + + this.reasonCode = reasonCode; + return this; + } + + /** + * Get reasonCode + * @return reasonCode + **/ + @javax.annotation.Nullable + public String getReasonCode() { + return reasonCode; + } + + + public void setReasonCode(String reasonCode) { + this.reasonCode = reasonCode; + } + + + public DocumentAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public DocumentAttributes evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public DocumentAttributes frontDocumentId(String frontDocumentId) { + + this.frontDocumentId = frontDocumentId; + return this; + } + + /** + * Get frontDocumentId + * @return frontDocumentId + **/ + @javax.annotation.Nullable + public String getFrontDocumentId() { + return frontDocumentId; + } + + + public void setFrontDocumentId(String frontDocumentId) { + this.frontDocumentId = frontDocumentId; + } + + + public DocumentAttributes backDocumentId(String backDocumentId) { + + this.backDocumentId = backDocumentId; + return this; + } + + /** + * Get backDocumentId + * @return backDocumentId + **/ + @javax.annotation.Nullable + public String getBackDocumentId() { + return backDocumentId; + } + + + public void setBackDocumentId(String backDocumentId) { + this.backDocumentId = backDocumentId; + } + + + public DocumentAttributes frontDocumentStoreId(String frontDocumentStoreId) { + + this.frontDocumentStoreId = frontDocumentStoreId; + return this; + } + + /** + * Get frontDocumentStoreId + * @return frontDocumentStoreId + **/ + @javax.annotation.Nullable + public String getFrontDocumentStoreId() { + return frontDocumentStoreId; + } + + + public void setFrontDocumentStoreId(String frontDocumentStoreId) { + this.frontDocumentStoreId = frontDocumentStoreId; + } + + + public DocumentAttributes backDocumentStoreId(String backDocumentStoreId) { + + this.backDocumentStoreId = backDocumentStoreId; + return this; + } + + /** + * Get backDocumentStoreId + * @return backDocumentStoreId + **/ + @javax.annotation.Nullable + public String getBackDocumentStoreId() { + return backDocumentStoreId; + } + + + public void setBackDocumentStoreId(String backDocumentStoreId) { + this.backDocumentStoreId = backDocumentStoreId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentAttributes documentAttributes = (DocumentAttributes) o; + return Objects.equals(this.documentType, documentAttributes.documentType) && + Objects.equals(this.status, documentAttributes.status) && + Objects.equals(this.description, documentAttributes.description) && + Objects.equals(this.nationality, documentAttributes.nationality) && + Objects.equals(this.ssn, documentAttributes.ssn) && + Objects.equals(this.passport, documentAttributes.passport) && + Objects.equals(this.matriculaConsular, documentAttributes.matriculaConsular) && + Objects.equals(this.name, documentAttributes.name) && + Objects.equals(this.address, documentAttributes.address) && + Objects.equals(this.dateOfIncorporation, documentAttributes.dateOfIncorporation) && + Objects.equals(this.stateOfIncorporation, documentAttributes.stateOfIncorporation) && + Objects.equals(this.dateOfBirth, documentAttributes.dateOfBirth) && + Objects.equals(this.ein, documentAttributes.ein) && + Objects.equals(this.reasonCode, documentAttributes.reasonCode) && + Objects.equals(this.reason, documentAttributes.reason) && + Objects.equals(this.evaluationId, documentAttributes.evaluationId) && + Objects.equals(this.frontDocumentId, documentAttributes.frontDocumentId) && + Objects.equals(this.backDocumentId, documentAttributes.backDocumentId) && + Objects.equals(this.frontDocumentStoreId, documentAttributes.frontDocumentStoreId) && + Objects.equals(this.backDocumentStoreId, documentAttributes.backDocumentStoreId); + } + + @Override + public int hashCode() { + return Objects.hash(documentType, status, description, nationality, ssn, passport, matriculaConsular, name, address, dateOfIncorporation, stateOfIncorporation, dateOfBirth, ein, reasonCode, reason, evaluationId, frontDocumentId, backDocumentId, frontDocumentStoreId, backDocumentStoreId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentAttributes {\n"); + sb.append(" documentType: ").append(toIndentedString(documentType)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfIncorporation: ").append(toIndentedString(dateOfIncorporation)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" reasonCode: ").append(toIndentedString(reasonCode)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" frontDocumentId: ").append(toIndentedString(frontDocumentId)).append("\n"); + sb.append(" backDocumentId: ").append(toIndentedString(backDocumentId)).append("\n"); + sb.append(" frontDocumentStoreId: ").append(toIndentedString(frontDocumentStoreId)).append("\n"); + sb.append(" backDocumentStoreId: ").append(toIndentedString(backDocumentStoreId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("documentType"); + openapiFields.add("status"); + openapiFields.add("description"); + openapiFields.add("nationality"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("matriculaConsular"); + openapiFields.add("name"); + openapiFields.add("address"); + openapiFields.add("dateOfIncorporation"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("dateOfBirth"); + openapiFields.add("ein"); + openapiFields.add("reasonCode"); + openapiFields.add("reason"); + openapiFields.add("evaluationId"); + openapiFields.add("frontDocumentId"); + openapiFields.add("backDocumentId"); + openapiFields.add("frontDocumentStoreId"); + openapiFields.add("backDocumentStoreId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DocumentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocumentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentAttributes is not found in the empty JSON string", DocumentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DocumentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DocumentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DocumentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("documentType") != null && !jsonObj.get("documentType").isJsonNull()) && !jsonObj.get("documentType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `documentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("documentType").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("stateOfIncorporation") != null && !jsonObj.get("stateOfIncorporation").isJsonNull()) && !jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if ((jsonObj.get("reasonCode") != null && !jsonObj.get("reasonCode").isJsonNull()) && !jsonObj.get("reasonCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reasonCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasonCode").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + if ((jsonObj.get("frontDocumentId") != null && !jsonObj.get("frontDocumentId").isJsonNull()) && !jsonObj.get("frontDocumentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `frontDocumentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("frontDocumentId").toString())); + } + if ((jsonObj.get("backDocumentId") != null && !jsonObj.get("backDocumentId").isJsonNull()) && !jsonObj.get("backDocumentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `backDocumentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("backDocumentId").toString())); + } + if ((jsonObj.get("frontDocumentStoreId") != null && !jsonObj.get("frontDocumentStoreId").isJsonNull()) && !jsonObj.get("frontDocumentStoreId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `frontDocumentStoreId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("frontDocumentStoreId").toString())); + } + if ((jsonObj.get("backDocumentStoreId") != null && !jsonObj.get("backDocumentStoreId").isJsonNull()) && !jsonObj.get("backDocumentStoreId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `backDocumentStoreId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("backDocumentStoreId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocumentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DocumentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocumentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DocumentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocumentAttributes + * @throws IOException if the JSON string is invalid with respect to DocumentAttributes + */ + public static DocumentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentAttributes.class); + } + + /** + * Convert an instance of DocumentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DocumentsRelationship.java b/src/main/java/org/openapitools/client/model/DocumentsRelationship.java new file mode 100644 index 00000000..883025c3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DocumentsRelationship.java @@ -0,0 +1,234 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DocumentsRelationshipDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DocumentsRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DocumentsRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data = new ArrayList<>(); + + public DocumentsRelationship() { + } + + public DocumentsRelationship data(List data) { + + this.data = data; + return this; + } + + public DocumentsRelationship addDataItem(DocumentsRelationshipDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentsRelationship documentsRelationship = (DocumentsRelationship) o; + return Objects.equals(this.data, documentsRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentsRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DocumentsRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocumentsRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentsRelationship is not found in the empty JSON string", DocumentsRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DocumentsRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DocumentsRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DocumentsRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + DocumentsRelationshipDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocumentsRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentsRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentsRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DocumentsRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocumentsRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DocumentsRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocumentsRelationship + * @throws IOException if the JSON string is invalid with respect to DocumentsRelationship + */ + public static DocumentsRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentsRelationship.class); + } + + /** + * Convert an instance of DocumentsRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/DocumentsRelationshipDataInner.java b/src/main/java/org/openapitools/client/model/DocumentsRelationshipDataInner.java new file mode 100644 index 00000000..af2de5c1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/DocumentsRelationshipDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DocumentsRelationshipDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DocumentsRelationshipDataInner { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "document"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public DocumentsRelationshipDataInner() { + } + + public DocumentsRelationshipDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public DocumentsRelationshipDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocumentsRelationshipDataInner documentsRelationshipDataInner = (DocumentsRelationshipDataInner) o; + return Objects.equals(this.type, documentsRelationshipDataInner.type) && + Objects.equals(this.id, documentsRelationshipDataInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocumentsRelationshipDataInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DocumentsRelationshipDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocumentsRelationshipDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentsRelationshipDataInner is not found in the empty JSON string", DocumentsRelationshipDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DocumentsRelationshipDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DocumentsRelationshipDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocumentsRelationshipDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentsRelationshipDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentsRelationshipDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DocumentsRelationshipDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocumentsRelationshipDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DocumentsRelationshipDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocumentsRelationshipDataInner + * @throws IOException if the JSON string is invalid with respect to DocumentsRelationshipDataInner + */ + public static DocumentsRelationshipDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentsRelationshipDataInner.class); + } + + /** + * Convert an instance of DocumentsRelationshipDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/EntityType.java b/src/main/java/org/openapitools/client/model/EntityType.java new file mode 100644 index 00000000..331561d7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/EntityType.java @@ -0,0 +1,80 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets entityType + */ +@JsonAdapter(EntityType.Adapter.class) +public enum EntityType { + + CORPORATION("Corporation"), + + LLC("LLC"), + + PARTNERSHIP("Partnership"), + + PUBLICLYTRADEDCORPORATION("PubliclyTradedCorporation"), + + PRIVATELYHELDCORPORATION("PrivatelyHeldCorporation"), + + NOTFORPROFITORGANIZATION("NotForProfitOrganization"); + + private String value; + + EntityType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EntityType fromValue(String value) { + for (EntityType b : EntityType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EntityType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EntityType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EntityType.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/EvaluationParams.java b/src/main/java/org/openapitools/client/model/EvaluationParams.java new file mode 100644 index 00000000..dbb3a4d8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/EvaluationParams.java @@ -0,0 +1,285 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EvaluationParams + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EvaluationParams { + /** + * Gets or Sets useSelfieVerification + */ + @JsonAdapter(UseSelfieVerificationEnum.Adapter.class) + public enum UseSelfieVerificationEnum { + NEVER("Never"), + + REPLACEIDENTIFICATION("ReplaceIdentification"), + + ALWAYS("Always"); + + private String value; + + UseSelfieVerificationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UseSelfieVerificationEnum fromValue(String value) { + for (UseSelfieVerificationEnum b : UseSelfieVerificationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final UseSelfieVerificationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UseSelfieVerificationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UseSelfieVerificationEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_USE_SELFIE_VERIFICATION = "useSelfieVerification"; + @SerializedName(SERIALIZED_NAME_USE_SELFIE_VERIFICATION) + private UseSelfieVerificationEnum useSelfieVerification; + + public static final String SERIALIZED_NAME_REQUIRE_ID_VERIFICATION = "requireIdVerification"; + @SerializedName(SERIALIZED_NAME_REQUIRE_ID_VERIFICATION) + private Boolean requireIdVerification = false; + + public EvaluationParams() { + } + + public EvaluationParams useSelfieVerification(UseSelfieVerificationEnum useSelfieVerification) { + + this.useSelfieVerification = useSelfieVerification; + return this; + } + + /** + * Get useSelfieVerification + * @return useSelfieVerification + **/ + @javax.annotation.Nullable + public UseSelfieVerificationEnum getUseSelfieVerification() { + return useSelfieVerification; + } + + + public void setUseSelfieVerification(UseSelfieVerificationEnum useSelfieVerification) { + this.useSelfieVerification = useSelfieVerification; + } + + + public EvaluationParams requireIdVerification(Boolean requireIdVerification) { + + this.requireIdVerification = requireIdVerification; + return this; + } + + /** + * Get requireIdVerification + * @return requireIdVerification + **/ + @javax.annotation.Nullable + public Boolean getRequireIdVerification() { + return requireIdVerification; + } + + + public void setRequireIdVerification(Boolean requireIdVerification) { + this.requireIdVerification = requireIdVerification; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EvaluationParams evaluationParams = (EvaluationParams) o; + return Objects.equals(this.useSelfieVerification, evaluationParams.useSelfieVerification) && + Objects.equals(this.requireIdVerification, evaluationParams.requireIdVerification); + } + + @Override + public int hashCode() { + return Objects.hash(useSelfieVerification, requireIdVerification); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EvaluationParams {\n"); + sb.append(" useSelfieVerification: ").append(toIndentedString(useSelfieVerification)).append("\n"); + sb.append(" requireIdVerification: ").append(toIndentedString(requireIdVerification)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("useSelfieVerification"); + openapiFields.add("requireIdVerification"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EvaluationParams + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EvaluationParams.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EvaluationParams is not found in the empty JSON string", EvaluationParams.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EvaluationParams.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EvaluationParams` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("useSelfieVerification") != null && !jsonObj.get("useSelfieVerification").isJsonNull()) && !jsonObj.get("useSelfieVerification").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `useSelfieVerification` to be a primitive type in the JSON string but got `%s`", jsonObj.get("useSelfieVerification").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EvaluationParams.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EvaluationParams' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EvaluationParams.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EvaluationParams value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EvaluationParams read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EvaluationParams given an JSON string + * + * @param jsonString JSON string + * @return An instance of EvaluationParams + * @throws IOException if the JSON string is invalid with respect to EvaluationParams + */ + public static EvaluationParams fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EvaluationParams.class); + } + + /** + * Convert an instance of EvaluationParams to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Event.java b/src/main/java/org/openapitools/client/model/Event.java new file mode 100644 index 00000000..66869e24 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Event.java @@ -0,0 +1,304 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Event + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Event { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private Object attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private Object relationships; + + public Event() { + } + + public Event type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Event id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Event attributes(Object attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public Object getAttributes() { + return attributes; + } + + + public void setAttributes(Object attributes) { + this.attributes = attributes; + } + + + public Event relationships(Object relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public Object getRelationships() { + return relationships; + } + + + public void setRelationships(Object relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Event event = (Event) o; + return Objects.equals(this.type, event.type) && + Objects.equals(this.id, event.id) && + Objects.equals(this.attributes, event.attributes) && + Objects.equals(this.relationships, event.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Event {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Event + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Event.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Event is not found in the empty JSON string", Event.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Event.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Event` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Event.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Event.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Event' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Event.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Event value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Event read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Event given an JSON string + * + * @param jsonString JSON string + * @return An instance of Event + * @throws IOException if the JSON string is invalid with respect to Event + */ + public static Event fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Event.class); + } + + /** + * Convert an instance of Event to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Execute200Response.java b/src/main/java/org/openapitools/client/model/Execute200Response.java new file mode 100644 index 00000000..3e78d964 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Execute200Response.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Document; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Execute200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Execute200Response { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public Execute200Response() { + } + + public Execute200Response data(List data) { + + this.data = data; + return this; + } + + public Execute200Response addDataItem(Document dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Execute200Response execute200Response = (Execute200Response) o; + return Objects.equals(this.data, execute200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Execute200Response {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Execute200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Execute200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Execute200Response is not found in the empty JSON string", Execute200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Execute200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Execute200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Document.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Execute200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Execute200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Execute200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Execute200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Execute200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Execute200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of Execute200Response + * @throws IOException if the JSON string is invalid with respect to Execute200Response + */ + public static Execute200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Execute200Response.class); + } + + /** + * Convert an instance of Execute200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Execute200Response1.java b/src/main/java/org/openapitools/client/model/Execute200Response1.java new file mode 100644 index 00000000..a9c155f9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Execute200Response1.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Authorization; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Execute200Response1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Execute200Response1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public Execute200Response1() { + } + + public Execute200Response1 data(List data) { + + this.data = data; + return this; + } + + public Execute200Response1 addDataItem(Authorization dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Execute200Response1 execute200Response1 = (Execute200Response1) o; + return Objects.equals(this.data, execute200Response1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Execute200Response1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Execute200Response1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Execute200Response1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Execute200Response1 is not found in the empty JSON string", Execute200Response1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Execute200Response1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Execute200Response1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Authorization.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Execute200Response1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Execute200Response1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Execute200Response1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Execute200Response1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Execute200Response1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Execute200Response1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Execute200Response1 + * @throws IOException if the JSON string is invalid with respect to Execute200Response1 + */ + public static Execute200Response1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Execute200Response1.class); + } + + /** + * Convert an instance of Execute200Response1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Execute200Response2.java b/src/main/java/org/openapitools/client/model/Execute200Response2.java new file mode 100644 index 00000000..3f710f3a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Execute200Response2.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AuthorizationRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Execute200Response2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Execute200Response2 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public Execute200Response2() { + } + + public Execute200Response2 data(List data) { + + this.data = data; + return this; + } + + public Execute200Response2 addDataItem(AuthorizationRequest dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Execute200Response2 execute200Response2 = (Execute200Response2) o; + return Objects.equals(this.data, execute200Response2.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Execute200Response2 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Execute200Response2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Execute200Response2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Execute200Response2 is not found in the empty JSON string", Execute200Response2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Execute200Response2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Execute200Response2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + AuthorizationRequest.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Execute200Response2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Execute200Response2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Execute200Response2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Execute200Response2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Execute200Response2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Execute200Response2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Execute200Response2 + * @throws IOException if the JSON string is invalid with respect to Execute200Response2 + */ + public static Execute200Response2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Execute200Response2.class); + } + + /** + * Convert an instance of Execute200Response2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Execute200Response3.java b/src/main/java/org/openapitools/client/model/Execute200Response3.java new file mode 100644 index 00000000..5a852e8f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Execute200Response3.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.CheckPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Execute200Response3 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Execute200Response3 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public Execute200Response3() { + } + + public Execute200Response3 data(List data) { + + this.data = data; + return this; + } + + public Execute200Response3 addDataItem(CheckPayment dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Execute200Response3 execute200Response3 = (Execute200Response3) o; + return Objects.equals(this.data, execute200Response3.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Execute200Response3 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Execute200Response3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Execute200Response3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Execute200Response3 is not found in the empty JSON string", Execute200Response3.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Execute200Response3.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Execute200Response3` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + CheckPayment.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Execute200Response3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Execute200Response3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Execute200Response3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Execute200Response3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Execute200Response3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Execute200Response3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Execute200Response3 + * @throws IOException if the JSON string is invalid with respect to Execute200Response3 + */ + public static Execute200Response3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Execute200Response3.class); + } + + /** + * Convert an instance of Execute200Response3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter.java new file mode 100644 index 00000000..c928a881 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter.java @@ -0,0 +1,405 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AWAITINGDOCUMENTS("AwaitingDocuments"), + + PENDINGREVIEW("PendingReview"), + + PENDING("Pending"), + + APPROVED("Approved"), + + DENIED("Denied"), + + CANCELED("Canceled"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter() { + } + + public ExecuteFilterParameter query(String query) { + + this.query = query; + return this; + } + + /** + * Get query + * @return query + **/ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public ExecuteFilterParameter status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public ExecuteFilterParameter tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter executeFilterParameter = (ExecuteFilterParameter) o; + return Objects.equals(this.query, executeFilterParameter.query) && + Objects.equals(this.status, executeFilterParameter.status) && + Objects.equals(this.email, executeFilterParameter.email) && + Objects.equals(this.tags, executeFilterParameter.tags); + } + + @Override + public int hashCode() { + return Objects.hash(query, status, email, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("query"); + openapiFields.add("status"); + openapiFields.add("email"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter is not found in the empty JSON string", ExecuteFilterParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter + */ + public static ExecuteFilterParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter.class); + } + + /** + * Convert an instance of ExecuteFilterParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.query != null){ + params.add(new Pair("filter[query]", this.query)); + } + + if(this.email != null){ + params.add(new Pair("filter[email]", this.email)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter1.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter1.java new file mode 100644 index 00000000..f23b0d41 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter1.java @@ -0,0 +1,397 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter1 { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + APPROVED("Approved"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter1() { + } + + public ExecuteFilterParameter1 query(String query) { + + this.query = query; + return this; + } + + /** + * Get query + * @return query + **/ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public ExecuteFilterParameter1 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter1 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter1 email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public ExecuteFilterParameter1 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter1 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter1 executeFilterParameter1 = (ExecuteFilterParameter1) o; + return Objects.equals(this.query, executeFilterParameter1.query) && + Objects.equals(this.status, executeFilterParameter1.status) && + Objects.equals(this.email, executeFilterParameter1.email) && + Objects.equals(this.tags, executeFilterParameter1.tags); + } + + @Override + public int hashCode() { + return Objects.hash(query, status, email, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter1 {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("query"); + openapiFields.add("status"); + openapiFields.add("email"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter1 is not found in the empty JSON string", ExecuteFilterParameter1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter1 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter1 + */ + public static ExecuteFilterParameter1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter1.class); + } + + /** + * Convert an instance of ExecuteFilterParameter1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.query != null){ + params.add(new Pair("filter[query]", this.query)); + } + + if(this.email != null){ + params.add(new Pair("filter[email]", this.email)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter10.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter10.java new file mode 100644 index 00000000..bb8e1381 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter10.java @@ -0,0 +1,286 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.*; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter10 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter10 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_PERIOD = "period"; + @SerializedName(SERIALIZED_NAME_PERIOD) + private String period; + + public ExecuteFilterParameter10() { + } + + public ExecuteFilterParameter10 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter10 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter10 period(String period) { + + this.period = period; + return this; + } + + /** + * Get period + * @return period + **/ + @javax.annotation.Nullable + public String getPeriod() { + return period; + } + + + public void setPeriod(String period) { + this.period = period; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter10 executeFilterParameter10 = (ExecuteFilterParameter10) o; + return Objects.equals(this.accountId, executeFilterParameter10.accountId) && + Objects.equals(this.customerId, executeFilterParameter10.customerId) && + Objects.equals(this.period, executeFilterParameter10.period); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, period); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter10 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" period: ").append(toIndentedString(period)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("period"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter10 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter10.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter10 is not found in the empty JSON string", ExecuteFilterParameter10.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter10.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter10` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + if ((jsonObj.get("period") != null && !jsonObj.get("period").isJsonNull()) && !jsonObj.get("period").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `period` to be a primitive type in the JSON string but got `%s`", jsonObj.get("period").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter10.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter10' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter10.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter10 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter10 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter10 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter10 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter10 + */ + public static ExecuteFilterParameter10 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter10.class); + } + + /** + * Convert an instance of ExecuteFilterParameter10 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.period != null){ + params.add(new Pair("filter[period]", this.period)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter11.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter11.java new file mode 100644 index 00000000..63ed01b8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter11.java @@ -0,0 +1,491 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.*; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; + +import java.util.stream.Collectors; +import org.openapitools.client.Pair; +import org.openapitools.client.JSON; + +/** + * ExecuteFilterParameter11 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter11 { + public static final String SERIALIZED_NAME_TRANSACTION_ID = "transactionId"; + @SerializedName(SERIALIZED_NAME_TRANSACTION_ID) + private String transactionId; + + public static final String SERIALIZED_NAME_REWARDED_TRANSACTION_ID = "rewardedTransactionId"; + @SerializedName(SERIALIZED_NAME_REWARDED_TRANSACTION_ID) + private String rewardedTransactionId; + + public static final String SERIALIZED_NAME_RECEIVING_ACCOUNT_ID = "receivingAccountId"; + @SerializedName(SERIALIZED_NAME_RECEIVING_ACCOUNT_ID) + private String receivingAccountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_CARD_ID = "cardId"; + @SerializedName(SERIALIZED_NAME_CARD_ID) + private String cardId; + + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter11() { + } + + public ExecuteFilterParameter11 transactionId(String transactionId) { + + this.transactionId = transactionId; + return this; + } + + /** + * Get transactionId + * @return transactionId + **/ + @javax.annotation.Nullable + public String getTransactionId() { + return transactionId; + } + + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + + public ExecuteFilterParameter11 rewardedTransactionId(String rewardedTransactionId) { + + this.rewardedTransactionId = rewardedTransactionId; + return this; + } + + /** + * Get rewardedTransactionId + * @return rewardedTransactionId + **/ + @javax.annotation.Nullable + public String getRewardedTransactionId() { + return rewardedTransactionId; + } + + + public void setRewardedTransactionId(String rewardedTransactionId) { + this.rewardedTransactionId = rewardedTransactionId; + } + + + public ExecuteFilterParameter11 receivingAccountId(String receivingAccountId) { + + this.receivingAccountId = receivingAccountId; + return this; + } + + /** + * Get receivingAccountId + * @return receivingAccountId + **/ + @javax.annotation.Nullable + public String getReceivingAccountId() { + return receivingAccountId; + } + + + public void setReceivingAccountId(String receivingAccountId) { + this.receivingAccountId = receivingAccountId; + } + + + public ExecuteFilterParameter11 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter11 cardId(String cardId) { + + this.cardId = cardId; + return this; + } + + /** + * Get cardId + * @return cardId + **/ + @javax.annotation.Nullable + public String getCardId() { + return cardId; + } + + + public void setCardId(String cardId) { + this.cardId = cardId; + } + + + public ExecuteFilterParameter11 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter11 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter11 status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public ExecuteFilterParameter11 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter11 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter11 executeFilterParameter11 = (ExecuteFilterParameter11) o; + return Objects.equals(this.transactionId, executeFilterParameter11.transactionId) && + Objects.equals(this.rewardedTransactionId, executeFilterParameter11.rewardedTransactionId) && + Objects.equals(this.receivingAccountId, executeFilterParameter11.receivingAccountId) && + Objects.equals(this.customerId, executeFilterParameter11.customerId) && + Objects.equals(this.cardId, executeFilterParameter11.cardId) && + Objects.equals(this.since, executeFilterParameter11.since) && + Objects.equals(this.until, executeFilterParameter11.until) && + Objects.equals(this.status, executeFilterParameter11.status) && + Objects.equals(this.tags, executeFilterParameter11.tags); + } + + @Override + public int hashCode() { + return Objects.hash(transactionId, rewardedTransactionId, receivingAccountId, customerId, cardId, since, until, status, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter11 {\n"); + sb.append(" transactionId: ").append(toIndentedString(transactionId)).append("\n"); + sb.append(" rewardedTransactionId: ").append(toIndentedString(rewardedTransactionId)).append("\n"); + sb.append(" receivingAccountId: ").append(toIndentedString(receivingAccountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" cardId: ").append(toIndentedString(cardId)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transactionId"); + openapiFields.add("rewardedTransactionId"); + openapiFields.add("receivingAccountId"); + openapiFields.add("customerId"); + openapiFields.add("cardId"); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("status"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter11 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter11.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter11 is not found in the empty JSON string", ExecuteFilterParameter11.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter11.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter11` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("transactionId") != null && !jsonObj.get("transactionId").isJsonNull()) && !jsonObj.get("transactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transactionId").toString())); + } + if ((jsonObj.get("rewardedTransactionId") != null && !jsonObj.get("rewardedTransactionId").isJsonNull()) && !jsonObj.get("rewardedTransactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rewardedTransactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rewardedTransactionId").toString())); + } + if ((jsonObj.get("receivingAccountId") != null && !jsonObj.get("receivingAccountId").isJsonNull()) && !jsonObj.get("receivingAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `receivingAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("receivingAccountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + if ((jsonObj.get("cardId") != null && !jsonObj.get("cardId").isJsonNull()) && !jsonObj.get("cardId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardId").toString())); + } + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter11.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter11' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter11.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter11 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter11 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter11 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter11 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter11 + */ + public static ExecuteFilterParameter11 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter11.class); + } + + /** + * Convert an instance of ExecuteFilterParameter11 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.cardId != null){ + params.add(new Pair("filter[cardId]", this.cardId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.transactionId != null){ + params.add(new Pair("filter[transactionId]", this.transactionId)); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.status != null){ + params.add(new Pair("filter[status]", this.status)); + } + + if(this.receivingAccountId != null){ + params.add(new Pair("filter[receivingAccountId]", this.receivingAccountId)); + } + + if(this.rewardedTransactionId != null){ + params.add(new Pair("filter[rewardedTransactionId]", this.rewardedTransactionId)); + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter12.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter12.java new file mode 100644 index 00000000..243edb1b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter12.java @@ -0,0 +1,305 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter12 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter12 { + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private List type; + + public ExecuteFilterParameter12() { + } + + public ExecuteFilterParameter12 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter12 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter12 type(List type) { + + this.type = type; + return this; + } + + public ExecuteFilterParameter12 addTypeItem(String typeItem) { + if (this.type == null) { + this.type = new ArrayList<>(); + } + this.type.add(typeItem); + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public List getType() { + return type; + } + + + public void setType(List type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter12 executeFilterParameter12 = (ExecuteFilterParameter12) o; + return Objects.equals(this.since, executeFilterParameter12.since) && + Objects.equals(this.until, executeFilterParameter12.until) && + Objects.equals(this.type, executeFilterParameter12.type); + } + + @Override + public int hashCode() { + return Objects.hash(since, until, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter12 {\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter12 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter12.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter12 is not found in the empty JSON string", ExecuteFilterParameter12.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter12.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter12` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull() && !jsonObj.get("type").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be an array in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter12.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter12' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter12.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter12 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter12 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter12 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter12 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter12 + */ + public static ExecuteFilterParameter12 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter12.class); + } + + /** + * Convert an instance of ExecuteFilterParameter12 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.type != null){ + int i=0; + for (String t:this.type) { + params.add(new Pair(String.format("filter[type][%s]", i), t)); + i++; + } + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter13.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter13.java new file mode 100644 index 00000000..8f2b2e5a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter13.java @@ -0,0 +1,408 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter13 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter13 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AWAITINGIMAGES("AwaitingImages"), + + AWAITINGFRONTIMAGE("AwaitingFrontImage"), + + AWAITINGBACKIMAGE("AwaitingBackImage"), + + PENDING("Pending"), + + PENDINGREVIEW("PendingReview"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"), + + AWAITINGCUSTOMERCONFIRMATION("AwaitingCustomerConfirmation"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public ExecuteFilterParameter13() { + } + + public ExecuteFilterParameter13 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter13 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter13 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter13 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + public ExecuteFilterParameter13 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter13 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter13 executeFilterParameter13 = (ExecuteFilterParameter13) o; + return Objects.equals(this.accountId, executeFilterParameter13.accountId) && + Objects.equals(this.customerId, executeFilterParameter13.customerId) && + Objects.equals(this.tags, executeFilterParameter13.tags) && + Objects.equals(this.status, executeFilterParameter13.status); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter13 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("tags"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter13 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter13.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter13 is not found in the empty JSON string", ExecuteFilterParameter13.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter13.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter13` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter13.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter13' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter13.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter13 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter13 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter13 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter13 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter13 + */ + public static ExecuteFilterParameter13 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter13.class); + } + + /** + * Convert an instance of ExecuteFilterParameter13 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter14.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter14.java new file mode 100644 index 00000000..ef175b38 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter14.java @@ -0,0 +1,313 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.*; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter14 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter14 { + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_FROM_ID = "fromId"; + @SerializedName(SERIALIZED_NAME_FROM_ID) + private Integer fromId; + + public static final String SERIALIZED_NAME_TO_ID = "toId"; + @SerializedName(SERIALIZED_NAME_TO_ID) + private Integer toId; + + public ExecuteFilterParameter14() { + } + + public ExecuteFilterParameter14 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter14 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter14 fromId(Integer fromId) { + + this.fromId = fromId; + return this; + } + + /** + * Get fromId + * @return fromId + **/ + @javax.annotation.Nullable + public Integer getFromId() { + return fromId; + } + + + public void setFromId(Integer fromId) { + this.fromId = fromId; + } + + + public ExecuteFilterParameter14 toId(Integer toId) { + + this.toId = toId; + return this; + } + + /** + * Get toId + * @return toId + **/ + @javax.annotation.Nullable + public Integer getToId() { + return toId; + } + + + public void setToId(Integer toId) { + this.toId = toId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter14 executeFilterParameter14 = (ExecuteFilterParameter14) o; + return Objects.equals(this.since, executeFilterParameter14.since) && + Objects.equals(this.until, executeFilterParameter14.until) && + Objects.equals(this.fromId, executeFilterParameter14.fromId) && + Objects.equals(this.toId, executeFilterParameter14.toId); + } + + @Override + public int hashCode() { + return Objects.hash(since, until, fromId, toId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter14 {\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" fromId: ").append(toIndentedString(fromId)).append("\n"); + sb.append(" toId: ").append(toIndentedString(toId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("fromId"); + openapiFields.add("toId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter14 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter14.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter14 is not found in the empty JSON string", ExecuteFilterParameter14.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter14.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter14` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter14.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter14' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter14.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter14 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter14 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter14 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter14 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter14 + */ + public static ExecuteFilterParameter14 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter14.class); + } + + /** + * Convert an instance of ExecuteFilterParameter14 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + public List toParams(){ + List params = new ArrayList<>(); + + if(this.fromId != null){ + params.add(new Pair("filter[fromId]", this.fromId.toString())); + } + + if(this.toId != null){ + params.add(new Pair("filter[toId]", this.toId.toString())); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter15.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter15.java new file mode 100644 index 00000000..432f07f9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter15.java @@ -0,0 +1,324 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.*; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter15 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter15 { + public static final String SERIALIZED_NAME_COORDINATES = "coordinates"; + @SerializedName(SERIALIZED_NAME_COORDINATES) + private Object coordinates; + + public static final String SERIALIZED_NAME_SEARCH_RADIUS = "searchRadius"; + @SerializedName(SERIALIZED_NAME_SEARCH_RADIUS) + private Integer searchRadius; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + private String postalCode; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Object address; + + public ExecuteFilterParameter15() { + } + + public ExecuteFilterParameter15 coordinates(Object coordinates) { + + this.coordinates = coordinates; + return this; + } + + /** + * Get coordinates + * @return coordinates + **/ + @javax.annotation.Nullable + public Object getCoordinates() { + return coordinates; + } + + + public void setCoordinates(Object coordinates) { + this.coordinates = coordinates; + } + + + public ExecuteFilterParameter15 searchRadius(Integer searchRadius) { + + this.searchRadius = searchRadius; + return this; + } + + /** + * Get searchRadius + * @return searchRadius + **/ + @javax.annotation.Nullable + public Integer getSearchRadius() { + return searchRadius; + } + + + public void setSearchRadius(Integer searchRadius) { + this.searchRadius = searchRadius; + } + + + public ExecuteFilterParameter15 postalCode(String postalCode) { + + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + **/ + @javax.annotation.Nullable + public String getPostalCode() { + return postalCode; + } + + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + + public ExecuteFilterParameter15 address(Object address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Object getAddress() { + return address; + } + + + public void setAddress(Object address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter15 executeFilterParameter15 = (ExecuteFilterParameter15) o; + return Objects.equals(this.coordinates, executeFilterParameter15.coordinates) && + Objects.equals(this.searchRadius, executeFilterParameter15.searchRadius) && + Objects.equals(this.postalCode, executeFilterParameter15.postalCode) && + Objects.equals(this.address, executeFilterParameter15.address); + } + + @Override + public int hashCode() { + return Objects.hash(coordinates, searchRadius, postalCode, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter15 {\n"); + sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append(" searchRadius: ").append(toIndentedString(searchRadius)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("coordinates"); + openapiFields.add("searchRadius"); + openapiFields.add("postalCode"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter15 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter15.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter15 is not found in the empty JSON string", ExecuteFilterParameter15.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter15.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter15` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("postalCode") != null && !jsonObj.get("postalCode").isJsonNull()) && !jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter15.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter15' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter15.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter15 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter15 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter15 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter15 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter15 + */ + public static ExecuteFilterParameter15 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter15.class); + } + + /** + * Convert an instance of ExecuteFilterParameter15 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + public List toParams(){ + List params = new ArrayList<>(); + + if(this.address != null) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + String addressAsString = objectMapper.writeValueAsString(this.address); + params.add(new Pair("filter[address]", addressAsString)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + + if(this.postalCode != null){ + params.add(new Pair("filter[postalCode]", this.postalCode)); + } + + if(this.searchRadius != null){ + params.add(new Pair("filter[searchRadius]", this.searchRadius.toString())); + } + + if(this.coordinates != null) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + String coordinatesAsString = objectMapper.writeValueAsString(this.coordinates); + params.add(new Pair("filter[coordinates]", coordinatesAsString)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter16.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter16.java new file mode 100644 index 00000000..4412b613 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter16.java @@ -0,0 +1,716 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter16 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter16 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_CARD_ID = "cardId"; + @SerializedName(SERIALIZED_NAME_CARD_ID) + private String cardId; + + public static final String SERIALIZED_NAME_EXCLUDE_FEES = "excludeFees"; + @SerializedName(SERIALIZED_NAME_EXCLUDE_FEES) + private Boolean excludeFees; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private List type; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + DEBIT("Debit"), + + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private List direction; + + public static final String SERIALIZED_NAME_FROM_AMOUNT = "fromAmount"; + @SerializedName(SERIALIZED_NAME_FROM_AMOUNT) + private Integer fromAmount; + + public static final String SERIALIZED_NAME_TO_AMOUNT = "toAmount"; + @SerializedName(SERIALIZED_NAME_TO_AMOUNT) + private Integer toAmount; + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + private String accountType; + + public ExecuteFilterParameter16() { + } + + public ExecuteFilterParameter16 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter16 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter16 query(String query) { + + this.query = query; + return this; + } + + /** + * Get query + * @return query + **/ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public ExecuteFilterParameter16 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter16 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + public ExecuteFilterParameter16 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter16 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter16 cardId(String cardId) { + + this.cardId = cardId; + return this; + } + + /** + * Get cardId + * @return cardId + **/ + @javax.annotation.Nullable + public String getCardId() { + return cardId; + } + + + public void setCardId(String cardId) { + this.cardId = cardId; + } + + + public ExecuteFilterParameter16 excludeFees(Boolean excludeFees) { + + this.excludeFees = excludeFees; + return this; + } + + /** + * Get excludeFees + * @return excludeFees + **/ + @javax.annotation.Nullable + public Boolean getExcludeFees() { + return excludeFees; + } + + + public void setExcludeFees(Boolean excludeFees) { + this.excludeFees = excludeFees; + } + + + public ExecuteFilterParameter16 type(List type) { + + this.type = type; + return this; + } + + public ExecuteFilterParameter16 addTypeItem(String typeItem) { + if (this.type == null) { + this.type = new ArrayList<>(); + } + this.type.add(typeItem); + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public List getType() { + return type; + } + + + public void setType(List type) { + this.type = type; + } + + + public ExecuteFilterParameter16 direction(List direction) { + + this.direction = direction; + return this; + } + + public ExecuteFilterParameter16 addDirectionItem(DirectionEnum directionItem) { + if (this.direction == null) { + this.direction = new ArrayList<>(); + } + this.direction.add(directionItem); + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public List getDirection() { + return direction; + } + + + public void setDirection(List direction) { + this.direction = direction; + } + + + public ExecuteFilterParameter16 fromAmount(Integer fromAmount) { + + this.fromAmount = fromAmount; + return this; + } + + /** + * Get fromAmount + * @return fromAmount + **/ + @javax.annotation.Nullable + public Integer getFromAmount() { + return fromAmount; + } + + + public void setFromAmount(Integer fromAmount) { + this.fromAmount = fromAmount; + } + + + public ExecuteFilterParameter16 toAmount(Integer toAmount) { + + this.toAmount = toAmount; + return this; + } + + /** + * Get toAmount + * @return toAmount + **/ + @javax.annotation.Nullable + public Integer getToAmount() { + return toAmount; + } + + + public void setToAmount(Integer toAmount) { + this.toAmount = toAmount; + } + + + public ExecuteFilterParameter16 accountType(String accountType) { + + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * @return accountType + **/ + @javax.annotation.Nullable + public String getAccountType() { + return accountType; + } + + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter16 executeFilterParameter16 = (ExecuteFilterParameter16) o; + return Objects.equals(this.accountId, executeFilterParameter16.accountId) && + Objects.equals(this.customerId, executeFilterParameter16.customerId) && + Objects.equals(this.query, executeFilterParameter16.query) && + Objects.equals(this.tags, executeFilterParameter16.tags) && + Objects.equals(this.since, executeFilterParameter16.since) && + Objects.equals(this.until, executeFilterParameter16.until) && + Objects.equals(this.cardId, executeFilterParameter16.cardId) && + Objects.equals(this.excludeFees, executeFilterParameter16.excludeFees) && + Objects.equals(this.type, executeFilterParameter16.type) && + Objects.equals(this.direction, executeFilterParameter16.direction) && + Objects.equals(this.fromAmount, executeFilterParameter16.fromAmount) && + Objects.equals(this.toAmount, executeFilterParameter16.toAmount) && + Objects.equals(this.accountType, executeFilterParameter16.accountType); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, query, tags, since, until, cardId, excludeFees, type, direction, fromAmount, toAmount, accountType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter16 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" cardId: ").append(toIndentedString(cardId)).append("\n"); + sb.append(" excludeFees: ").append(toIndentedString(excludeFees)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" fromAmount: ").append(toIndentedString(fromAmount)).append("\n"); + sb.append(" toAmount: ").append(toIndentedString(toAmount)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("query"); + openapiFields.add("tags"); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("cardId"); + openapiFields.add("excludeFees"); + openapiFields.add("type"); + openapiFields.add("direction"); + openapiFields.add("fromAmount"); + openapiFields.add("toAmount"); + openapiFields.add("accountType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter16 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter16.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter16 is not found in the empty JSON string", ExecuteFilterParameter16.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter16.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter16` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + if ((jsonObj.get("cardId") != null && !jsonObj.get("cardId").isJsonNull()) && !jsonObj.get("cardId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull() && !jsonObj.get("type").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be an array in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull() && !jsonObj.get("direction").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be an array in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if ((jsonObj.get("accountType") != null && !jsonObj.get("accountType").isJsonNull()) && !jsonObj.get("accountType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter16.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter16' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter16.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter16 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter16 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter16 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter16 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter16 + */ + public static ExecuteFilterParameter16 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter16.class); + } + + /** + * Convert an instance of ExecuteFilterParameter16 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.cardId != null){ + params.add(new Pair("filter[cardId]", this.cardId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.type != null){ + int i=0; + for (String t:this.type) { + params.add(new Pair(String.format("filter[type][%s]", i), t)); + i++; + } + } + + if(this.direction != null){ + int i=0; + for (DirectionEnum d:this.direction) { + params.add(new Pair(String.format("filter[direction][%s]", i), d.getValue())); + i++; + } + } + + if(this.fromAmount != null){ + params.add(new Pair("filter[fromAmount]", this.fromAmount.toString())); + } + + if(this.toAmount != null){ + params.add(new Pair("filter[toAmount]", this.toAmount.toString())); + } + + if(this.query != null){ + params.add(new Pair("filter[query]", this.query)); + } + + if(this.accountType != null){ + params.add(new Pair("filter[accountType]", this.accountType)); + } + + if(this.excludeFees != null){ + params.add(new Pair("filter[excludeFees]", this.excludeFees.toString())); + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter17.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter17.java new file mode 100644 index 00000000..2459859d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter17.java @@ -0,0 +1,214 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.*; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter17 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter17 { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public ExecuteFilterParameter17() { + } + + public ExecuteFilterParameter17 query(String query) { + + this.query = query; + return this; + } + + /** + * Get query + * @return query + **/ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter17 executeFilterParameter17 = (ExecuteFilterParameter17) o; + return Objects.equals(this.query, executeFilterParameter17.query); + } + + @Override + public int hashCode() { + return Objects.hash(query); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter17 {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("query"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter17 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter17.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter17 is not found in the empty JSON string", ExecuteFilterParameter17.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter17.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter17` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter17.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter17' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter17.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter17 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter17 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter17 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter17 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter17 + */ + public static ExecuteFilterParameter17 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter17.class); + } + + /** + * Convert an instance of ExecuteFilterParameter17 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams() { + List params = new ArrayList<>(); + + if (this.query != null) { + params.add(new Pair("filter[query]", this.query)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter18.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter18.java new file mode 100644 index 00000000..9b9b9338 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter18.java @@ -0,0 +1,488 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter18 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter18 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CREDIT_ACCOUNT_ID = "creditAccountId"; + @SerializedName(SERIALIZED_NAME_CREDIT_ACCOUNT_ID) + private String creditAccountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + PENDINGREVIEW("PendingReview"), + + RETURNED("Returned"), + + SENT("Sent"), + + REJECTED("Rejected"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACHREPAYMENT("AchRepayment"), + + BOOKREPAYMENT("BookRepayment"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private List type; + + public ExecuteFilterParameter18() { + } + + public ExecuteFilterParameter18 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter18 creditAccountId(String creditAccountId) { + + this.creditAccountId = creditAccountId; + return this; + } + + /** + * Get creditAccountId + * @return creditAccountId + **/ + @javax.annotation.Nullable + public String getCreditAccountId() { + return creditAccountId; + } + + + public void setCreditAccountId(String creditAccountId) { + this.creditAccountId = creditAccountId; + } + + + public ExecuteFilterParameter18 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter18 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter18 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter18 type(List type) { + + this.type = type; + return this; + } + + public ExecuteFilterParameter18 addTypeItem(TypeEnum typeItem) { + if (this.type == null) { + this.type = new ArrayList<>(); + } + this.type.add(typeItem); + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public List getType() { + return type; + } + + + public void setType(List type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter18 executeFilterParameter18 = (ExecuteFilterParameter18) o; + return Objects.equals(this.accountId, executeFilterParameter18.accountId) && + Objects.equals(this.creditAccountId, executeFilterParameter18.creditAccountId) && + Objects.equals(this.customerId, executeFilterParameter18.customerId) && + Objects.equals(this.status, executeFilterParameter18.status) && + Objects.equals(this.type, executeFilterParameter18.type); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, creditAccountId, customerId, status, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter18 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" creditAccountId: ").append(toIndentedString(creditAccountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("creditAccountId"); + openapiFields.add("customerId"); + openapiFields.add("status"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter18 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter18.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter18 is not found in the empty JSON string", ExecuteFilterParameter18.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter18.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter18` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("creditAccountId") != null && !jsonObj.get("creditAccountId").isJsonNull()) && !jsonObj.get("creditAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creditAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditAccountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull() && !jsonObj.get("type").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be an array in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter18.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter18' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter18.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter18 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter18 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter18 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter18 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter18 + */ + public static ExecuteFilterParameter18 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter18.class); + } + + /** + * Convert an instance of ExecuteFilterParameter18 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.creditAccountId != null){ + params.add(new Pair("filter[creditAccountId]", this.creditAccountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.type != null){ + int i=0; + for (TypeEnum t:this.type) { + params.add(new Pair(String.format("filter[type][%s]", i), t.getValue())); + i++; + } + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter19.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter19.java new file mode 100644 index 00000000..7537f5eb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter19.java @@ -0,0 +1,588 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter19 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter19 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NEW("New"), + + PENDING("Pending"), + + CANCELED("Canceled"), + + REJECTED("Rejected"), + + INDELIVERY("InDelivery"), + + INPRODUCTION("InProduction"), + + DELIVERED("Delivered"), + + RETURNEDTOSENDER("ReturnedToSender"), + + PENDING2("Pending"), + + PROCESSED("Processed"), + + PENDINGREVIEW("PendingReview"), + + MARKEDFORRETURN("MarkedForReturn"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_FROM_AMOUNT = "fromAmount"; + @SerializedName(SERIALIZED_NAME_FROM_AMOUNT) + private Integer fromAmount; + + public static final String SERIALIZED_NAME_TO_AMOUNT = "toAmount"; + @SerializedName(SERIALIZED_NAME_TO_AMOUNT) + private Integer toAmount; + + public static final String SERIALIZED_NAME_CHECK_NUMBER = "checkNumber"; + @SerializedName(SERIALIZED_NAME_CHECK_NUMBER) + private String checkNumber; + + public ExecuteFilterParameter19() { + } + + public ExecuteFilterParameter19 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter19 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter19 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter19 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter19 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter19 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + public ExecuteFilterParameter19 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter19 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter19 fromAmount(Integer fromAmount) { + + this.fromAmount = fromAmount; + return this; + } + + /** + * Get fromAmount + * @return fromAmount + **/ + @javax.annotation.Nullable + public Integer getFromAmount() { + return fromAmount; + } + + + public void setFromAmount(Integer fromAmount) { + this.fromAmount = fromAmount; + } + + + public ExecuteFilterParameter19 toAmount(Integer toAmount) { + + this.toAmount = toAmount; + return this; + } + + /** + * Get toAmount + * @return toAmount + **/ + @javax.annotation.Nullable + public Integer getToAmount() { + return toAmount; + } + + + public void setToAmount(Integer toAmount) { + this.toAmount = toAmount; + } + + + public ExecuteFilterParameter19 checkNumber(String checkNumber) { + + this.checkNumber = checkNumber; + return this; + } + + /** + * Get checkNumber + * @return checkNumber + **/ + @javax.annotation.Nullable + public String getCheckNumber() { + return checkNumber; + } + + + public void setCheckNumber(String checkNumber) { + this.checkNumber = checkNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter19 executeFilterParameter19 = (ExecuteFilterParameter19) o; + return Objects.equals(this.accountId, executeFilterParameter19.accountId) && + Objects.equals(this.customerId, executeFilterParameter19.customerId) && + Objects.equals(this.status, executeFilterParameter19.status) && + Objects.equals(this.tags, executeFilterParameter19.tags) && + Objects.equals(this.since, executeFilterParameter19.since) && + Objects.equals(this.until, executeFilterParameter19.until) && + Objects.equals(this.fromAmount, executeFilterParameter19.fromAmount) && + Objects.equals(this.toAmount, executeFilterParameter19.toAmount) && + Objects.equals(this.checkNumber, executeFilterParameter19.checkNumber); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, status, tags, since, until, fromAmount, toAmount, checkNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter19 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" fromAmount: ").append(toIndentedString(fromAmount)).append("\n"); + sb.append(" toAmount: ").append(toIndentedString(toAmount)).append("\n"); + sb.append(" checkNumber: ").append(toIndentedString(checkNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("status"); + openapiFields.add("tags"); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("fromAmount"); + openapiFields.add("toAmount"); + openapiFields.add("checkNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter19 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter19.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter19 is not found in the empty JSON string", ExecuteFilterParameter19.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter19.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter19` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + if ((jsonObj.get("checkNumber") != null && !jsonObj.get("checkNumber").isJsonNull()) && !jsonObj.get("checkNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `checkNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("checkNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter19.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter19' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter19.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter19 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter19 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter19 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter19 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter19 + */ + public static ExecuteFilterParameter19 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter19.class); + } + + /** + * Convert an instance of ExecuteFilterParameter19 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.checkNumber != null){ + params.add(new Pair("filter[checkNumber]", this.checkNumber)); + } + + if(this.fromAmount != null){ + params.add(new Pair("filter[fromAmount]", this.fromAmount.toString())); + } + + if(this.toAmount != null){ + params.add(new Pair("filter[toAmount]", this.toAmount.toString())); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter2.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter2.java new file mode 100644 index 00000000..b7536bb7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter2.java @@ -0,0 +1,524 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter2 { + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + OPEN("Open"), + + FROZEN("Frozen"), + + CLOSED("Closed"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DEPOSIT("deposit"), + + CREDIT("credit"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private List type; + + public static final String SERIALIZED_NAME_FROM_BALANCE = "fromBalance"; + @SerializedName(SERIALIZED_NAME_FROM_BALANCE) + private BigDecimal fromBalance; + + public static final String SERIALIZED_NAME_TO_BALANCE = "toBalance"; + @SerializedName(SERIALIZED_NAME_TO_BALANCE) + private BigDecimal toBalance; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter2() { + } + + public ExecuteFilterParameter2 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter2 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter2 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter2 type(List type) { + + this.type = type; + return this; + } + + public ExecuteFilterParameter2 addTypeItem(TypeEnum typeItem) { + if (this.type == null) { + this.type = new ArrayList<>(); + } + this.type.add(typeItem); + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public List getType() { + return type; + } + + + public void setType(List type) { + this.type = type; + } + + + public ExecuteFilterParameter2 fromBalance(BigDecimal fromBalance) { + + this.fromBalance = fromBalance; + return this; + } + + /** + * Get fromBalance + * @return fromBalance + **/ + @javax.annotation.Nullable + public BigDecimal getFromBalance() { + return fromBalance; + } + + + public void setFromBalance(BigDecimal fromBalance) { + this.fromBalance = fromBalance; + } + + + public ExecuteFilterParameter2 toBalance(BigDecimal toBalance) { + + this.toBalance = toBalance; + return this; + } + + /** + * Get toBalance + * @return toBalance + **/ + @javax.annotation.Nullable + public BigDecimal getToBalance() { + return toBalance; + } + + + public void setToBalance(BigDecimal toBalance) { + this.toBalance = toBalance; + } + + + public ExecuteFilterParameter2 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter2 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter2 executeFilterParameter2 = (ExecuteFilterParameter2) o; + return Objects.equals(this.customerId, executeFilterParameter2.customerId) && + Objects.equals(this.status, executeFilterParameter2.status) && + Objects.equals(this.type, executeFilterParameter2.type) && + Objects.equals(this.fromBalance, executeFilterParameter2.fromBalance) && + Objects.equals(this.toBalance, executeFilterParameter2.toBalance) && + Objects.equals(this.tags, executeFilterParameter2.tags); + } + + @Override + public int hashCode() { + return Objects.hash(customerId, status, type, fromBalance, toBalance, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter2 {\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" fromBalance: ").append(toIndentedString(fromBalance)).append("\n"); + sb.append(" toBalance: ").append(toIndentedString(toBalance)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customerId"); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("fromBalance"); + openapiFields.add("toBalance"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter2 is not found in the empty JSON string", ExecuteFilterParameter2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull() && !jsonObj.get("type").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be an array in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter2 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter2 + */ + public static ExecuteFilterParameter2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter2.class); + } + + /** + * Convert an instance of ExecuteFilterParameter2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.toBalance != null){ + params.add(new Pair("filter[toBalance]", this.toBalance.toString())); + } + + if(this.fromBalance != null){ + params.add(new Pair("filter[fromBalance]", this.fromBalance.toString())); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.type != null){ + int i=0; + for (TypeEnum t:this.type) { + params.add(new Pair(String.format("filter[type][%s]", i), t.getValue())); + i++; + } + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter20.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter20.java new file mode 100644 index 00000000..a5e57409 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter20.java @@ -0,0 +1,566 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter20 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter20 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("Active"), + + DISABLED("Disabled"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_FROM_AMOUNT = "fromAmount"; + @SerializedName(SERIALIZED_NAME_FROM_AMOUNT) + private Integer fromAmount; + + public static final String SERIALIZED_NAME_TO_AMOUNT = "toAmount"; + @SerializedName(SERIALIZED_NAME_TO_AMOUNT) + private Integer toAmount; + + public static final String SERIALIZED_NAME_CHECK_NUMBER = "checkNumber"; + @SerializedName(SERIALIZED_NAME_CHECK_NUMBER) + private String checkNumber; + + public ExecuteFilterParameter20() { + } + + public ExecuteFilterParameter20 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter20 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter20 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter20 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter20 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter20 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + public ExecuteFilterParameter20 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter20 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter20 fromAmount(Integer fromAmount) { + + this.fromAmount = fromAmount; + return this; + } + + /** + * Get fromAmount + * @return fromAmount + **/ + @javax.annotation.Nullable + public Integer getFromAmount() { + return fromAmount; + } + + + public void setFromAmount(Integer fromAmount) { + this.fromAmount = fromAmount; + } + + + public ExecuteFilterParameter20 toAmount(Integer toAmount) { + + this.toAmount = toAmount; + return this; + } + + /** + * Get toAmount + * @return toAmount + **/ + @javax.annotation.Nullable + public Integer getToAmount() { + return toAmount; + } + + + public void setToAmount(Integer toAmount) { + this.toAmount = toAmount; + } + + + public ExecuteFilterParameter20 checkNumber(String checkNumber) { + + this.checkNumber = checkNumber; + return this; + } + + /** + * Get checkNumber + * @return checkNumber + **/ + @javax.annotation.Nullable + public String getCheckNumber() { + return checkNumber; + } + + + public void setCheckNumber(String checkNumber) { + this.checkNumber = checkNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter20 executeFilterParameter20 = (ExecuteFilterParameter20) o; + return Objects.equals(this.accountId, executeFilterParameter20.accountId) && + Objects.equals(this.customerId, executeFilterParameter20.customerId) && + Objects.equals(this.status, executeFilterParameter20.status) && + Objects.equals(this.tags, executeFilterParameter20.tags) && + Objects.equals(this.since, executeFilterParameter20.since) && + Objects.equals(this.until, executeFilterParameter20.until) && + Objects.equals(this.fromAmount, executeFilterParameter20.fromAmount) && + Objects.equals(this.toAmount, executeFilterParameter20.toAmount) && + Objects.equals(this.checkNumber, executeFilterParameter20.checkNumber); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, status, tags, since, until, fromAmount, toAmount, checkNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter20 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" fromAmount: ").append(toIndentedString(fromAmount)).append("\n"); + sb.append(" toAmount: ").append(toIndentedString(toAmount)).append("\n"); + sb.append(" checkNumber: ").append(toIndentedString(checkNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("status"); + openapiFields.add("tags"); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("fromAmount"); + openapiFields.add("toAmount"); + openapiFields.add("checkNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter20 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter20.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter20 is not found in the empty JSON string", ExecuteFilterParameter20.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter20.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter20` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + if ((jsonObj.get("checkNumber") != null && !jsonObj.get("checkNumber").isJsonNull()) && !jsonObj.get("checkNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `checkNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("checkNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter20.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter20' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter20.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter20 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter20 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter20 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter20 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter20 + */ + public static ExecuteFilterParameter20 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter20.class); + } + + /** + * Convert an instance of ExecuteFilterParameter20 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.checkNumber != null){ + params.add(new Pair("filter[checkNumber]", this.checkNumber)); + } + + if(this.fromAmount != null){ + params.add(new Pair("filter[fromAmount]", this.fromAmount.toString())); + } + + if(this.toAmount != null){ + params.add(new Pair("filter[toAmount]", this.toAmount.toString())); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter3.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter3.java new file mode 100644 index 00000000..a5d74b18 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter3.java @@ -0,0 +1,397 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter3 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter3 { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("Active"), + + ARCHIVED("Archived"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter3() { + } + + public ExecuteFilterParameter3 query(String query) { + + this.query = query; + return this; + } + + /** + * Get query + * @return query + **/ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public ExecuteFilterParameter3 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter3 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter3 email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public ExecuteFilterParameter3 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter3 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter3 executeFilterParameter3 = (ExecuteFilterParameter3) o; + return Objects.equals(this.query, executeFilterParameter3.query) && + Objects.equals(this.status, executeFilterParameter3.status) && + Objects.equals(this.email, executeFilterParameter3.email) && + Objects.equals(this.tags, executeFilterParameter3.tags); + } + + @Override + public int hashCode() { + return Objects.hash(query, status, email, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter3 {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("query"); + openapiFields.add("status"); + openapiFields.add("email"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter3 is not found in the empty JSON string", ExecuteFilterParameter3.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter3.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter3` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter3 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter3 + */ + public static ExecuteFilterParameter3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter3.class); + } + + /** + * Convert an instance of ExecuteFilterParameter3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.email != null){ + params.add(new Pair("filter[email]", this.email)); + } + + if(this.query != null){ + params.add(new Pair("filter[query]", this.query)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter4.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter4.java new file mode 100644 index 00000000..776dae13 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter4.java @@ -0,0 +1,887 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter4 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter4 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT_ID = "counterpartyAccountId"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT_ID) + private String counterpartyAccountId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + REJECTED("Rejected"), + + PENDING("Pending"), + + CANCELED("Canceled"), + + PENDING_REVIEW("Pending Review"), + + CLEARING("Clearing"), + + SENT("Sent"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACHPAYMENT("AchPayment"), + + BOOKPAYMENT("BookPayment"), + + WIREPAYMENT("WirePayment"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private List type; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + DEBIT("Debit"), + + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private List direction; + + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_FROM_AMOUNT = "fromAmount"; + @SerializedName(SERIALIZED_NAME_FROM_AMOUNT) + private Integer fromAmount; + + public static final String SERIALIZED_NAME_TO_AMOUNT = "toAmount"; + @SerializedName(SERIALIZED_NAME_TO_AMOUNT) + private Integer toAmount; + + public static final String SERIALIZED_NAME_RECURRING_PAYMENT_ID = "recurringPaymentId"; + @SerializedName(SERIALIZED_NAME_RECURRING_PAYMENT_ID) + private Integer recurringPaymentId; + + /** + * Gets or Sets feature + */ + @JsonAdapter(FeatureEnum.Adapter.class) + public enum FeatureEnum { + SAMEDAY("SameDay"), + + RECURRINGPAYMENT("RecurringPayment"); + + private String value; + + FeatureEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FeatureEnum fromValue(String value) { + for (FeatureEnum b : FeatureEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final FeatureEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FeatureEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FeatureEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_FEATURE = "feature"; + @SerializedName(SERIALIZED_NAME_FEATURE) + private List feature; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter4() { + } + + public ExecuteFilterParameter4 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter4 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter4 counterpartyAccountId(String counterpartyAccountId) { + + this.counterpartyAccountId = counterpartyAccountId; + return this; + } + + /** + * Get counterpartyAccountId + * @return counterpartyAccountId + **/ + @javax.annotation.Nullable + public String getCounterpartyAccountId() { + return counterpartyAccountId; + } + + + public void setCounterpartyAccountId(String counterpartyAccountId) { + this.counterpartyAccountId = counterpartyAccountId; + } + + + public ExecuteFilterParameter4 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter4 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter4 type(List type) { + + this.type = type; + return this; + } + + public ExecuteFilterParameter4 addTypeItem(TypeEnum typeItem) { + if (this.type == null) { + this.type = new ArrayList<>(); + } + this.type.add(typeItem); + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public List getType() { + return type; + } + + + public void setType(List type) { + this.type = type; + } + + + public ExecuteFilterParameter4 direction(List direction) { + + this.direction = direction; + return this; + } + + public ExecuteFilterParameter4 addDirectionItem(DirectionEnum directionItem) { + if (this.direction == null) { + this.direction = new ArrayList<>(); + } + this.direction.add(directionItem); + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public List getDirection() { + return direction; + } + + + public void setDirection(List direction) { + this.direction = direction; + } + + + public ExecuteFilterParameter4 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter4 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter4 fromAmount(Integer fromAmount) { + + this.fromAmount = fromAmount; + return this; + } + + /** + * Get fromAmount + * @return fromAmount + **/ + @javax.annotation.Nullable + public Integer getFromAmount() { + return fromAmount; + } + + + public void setFromAmount(Integer fromAmount) { + this.fromAmount = fromAmount; + } + + + public ExecuteFilterParameter4 toAmount(Integer toAmount) { + + this.toAmount = toAmount; + return this; + } + + /** + * Get toAmount + * @return toAmount + **/ + @javax.annotation.Nullable + public Integer getToAmount() { + return toAmount; + } + + + public void setToAmount(Integer toAmount) { + this.toAmount = toAmount; + } + + + public ExecuteFilterParameter4 recurringPaymentId(Integer recurringPaymentId) { + + this.recurringPaymentId = recurringPaymentId; + return this; + } + + /** + * Get recurringPaymentId + * @return recurringPaymentId + **/ + @javax.annotation.Nullable + public Integer getRecurringPaymentId() { + return recurringPaymentId; + } + + + public void setRecurringPaymentId(Integer recurringPaymentId) { + this.recurringPaymentId = recurringPaymentId; + } + + + public ExecuteFilterParameter4 feature(List feature) { + + this.feature = feature; + return this; + } + + public ExecuteFilterParameter4 addFeatureItem(FeatureEnum featureItem) { + if (this.feature == null) { + this.feature = new ArrayList<>(); + } + this.feature.add(featureItem); + return this; + } + + /** + * Get feature + * @return feature + **/ + @javax.annotation.Nullable + public List getFeature() { + return feature; + } + + + public void setFeature(List feature) { + this.feature = feature; + } + + + public ExecuteFilterParameter4 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter4 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter4 executeFilterParameter4 = (ExecuteFilterParameter4) o; + return Objects.equals(this.accountId, executeFilterParameter4.accountId) && + Objects.equals(this.customerId, executeFilterParameter4.customerId) && + Objects.equals(this.counterpartyAccountId, executeFilterParameter4.counterpartyAccountId) && + Objects.equals(this.status, executeFilterParameter4.status) && + Objects.equals(this.type, executeFilterParameter4.type) && + Objects.equals(this.direction, executeFilterParameter4.direction) && + Objects.equals(this.since, executeFilterParameter4.since) && + Objects.equals(this.until, executeFilterParameter4.until) && + Objects.equals(this.fromAmount, executeFilterParameter4.fromAmount) && + Objects.equals(this.toAmount, executeFilterParameter4.toAmount) && + Objects.equals(this.recurringPaymentId, executeFilterParameter4.recurringPaymentId) && + Objects.equals(this.feature, executeFilterParameter4.feature) && + Objects.equals(this.tags, executeFilterParameter4.tags); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, counterpartyAccountId, status, type, direction, since, until, fromAmount, toAmount, recurringPaymentId, feature, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter4 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" counterpartyAccountId: ").append(toIndentedString(counterpartyAccountId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" fromAmount: ").append(toIndentedString(fromAmount)).append("\n"); + sb.append(" toAmount: ").append(toIndentedString(toAmount)).append("\n"); + sb.append(" recurringPaymentId: ").append(toIndentedString(recurringPaymentId)).append("\n"); + sb.append(" feature: ").append(toIndentedString(feature)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("counterpartyAccountId"); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("direction"); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("fromAmount"); + openapiFields.add("toAmount"); + openapiFields.add("recurringPaymentId"); + openapiFields.add("feature"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter4.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter4 is not found in the empty JSON string", ExecuteFilterParameter4.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter4.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter4` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + if ((jsonObj.get("counterpartyAccountId") != null && !jsonObj.get("counterpartyAccountId").isJsonNull()) && !jsonObj.get("counterpartyAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyAccountId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull() && !jsonObj.get("type").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be an array in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("direction") != null && !jsonObj.get("direction").isJsonNull() && !jsonObj.get("direction").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be an array in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("feature") != null && !jsonObj.get("feature").isJsonNull() && !jsonObj.get("feature").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `feature` to be an array in the JSON string but got `%s`", jsonObj.get("feature").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter4.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter4 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter4 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter4 + */ + public static ExecuteFilterParameter4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter4.class); + } + + /** + * Convert an instance of ExecuteFilterParameter4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.counterpartyAccountId != null){ + params.add(new Pair("filter[counterpartyAccountId]", this.counterpartyAccountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.fromAmount != null){ + params.add(new Pair("filter[fromAmount]", this.fromAmount.toString())); + } + + if(this.recurringPaymentId != null){ + params.add(new Pair("filter[recurringPaymentId]", this.recurringPaymentId.toString())); + } + + if(this.toAmount != null){ + params.add(new Pair("filter[toAmount]", this.toAmount.toString())); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.direction != null){ + int i=0; + for (DirectionEnum d:this.direction) { + params.add(new Pair(String.format("filter[direction][%s]", i), d.getValue())); + i++; + } + } + + if(this.feature != null){ + int i=0; + for (FeatureEnum f:this.feature) { + params.add(new Pair(String.format("filter[status][%s]", i), f.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter5.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter5.java new file mode 100644 index 00000000..76152b18 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter5.java @@ -0,0 +1,434 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter5 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter5 { + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + /** + * Gets or Sets permissions + */ + @JsonAdapter(PermissionsEnum.Adapter.class) + public enum PermissionsEnum { + CREDITONLY("CreditOnly"), + + DEBITONLY("DebitOnly"), + + CREDITANDDEBIT("CreditAndDebit"); + + private String value; + + PermissionsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PermissionsEnum fromValue(String value) { + for (PermissionsEnum b : PermissionsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PermissionsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PermissionsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PermissionsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter5() { + } + + public ExecuteFilterParameter5 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter5 accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nullable + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public ExecuteFilterParameter5 routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nullable + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public ExecuteFilterParameter5 permissions(List permissions) { + + this.permissions = permissions; + return this; + } + + public ExecuteFilterParameter5 addPermissionsItem(PermissionsEnum permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + + /** + * Get permissions + * @return permissions + **/ + @javax.annotation.Nullable + public List getPermissions() { + return permissions; + } + + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + + public ExecuteFilterParameter5 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter5 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter5 executeFilterParameter5 = (ExecuteFilterParameter5) o; + return Objects.equals(this.customerId, executeFilterParameter5.customerId) && + Objects.equals(this.accountNumber, executeFilterParameter5.accountNumber) && + Objects.equals(this.routingNumber, executeFilterParameter5.routingNumber) && + Objects.equals(this.permissions, executeFilterParameter5.permissions) && + Objects.equals(this.tags, executeFilterParameter5.tags); + } + + @Override + public int hashCode() { + return Objects.hash(customerId, accountNumber, routingNumber, permissions, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter5 {\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customerId"); + openapiFields.add("accountNumber"); + openapiFields.add("routingNumber"); + openapiFields.add("permissions"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter5 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter5.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter5 is not found in the empty JSON string", ExecuteFilterParameter5.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter5.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter5` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + if ((jsonObj.get("accountNumber") != null && !jsonObj.get("accountNumber").isJsonNull()) && !jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if ((jsonObj.get("routingNumber") != null && !jsonObj.get("routingNumber").isJsonNull()) && !jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull() && !jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter5.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter5' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter5.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter5 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter5 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter5 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter5 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter5 + */ + public static ExecuteFilterParameter5 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter5.class); + } + + /** + * Convert an instance of ExecuteFilterParameter5 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountNumber != null){ + params.add(new Pair("filter[accountNumber]", this.accountNumber)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.routingNumber != null){ + params.add(new Pair("filter[routingNumber]", this.routingNumber)); + } + + if(this.permissions != null){ + int i=0; + for (PermissionsEnum p:this.permissions) { + params.add(new Pair(String.format("filter[permissions][%s]", i), p.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter6.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter6.java new file mode 100644 index 00000000..8513302f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter6.java @@ -0,0 +1,543 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter6 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter6 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + RECURRINGCREDITACHPAYMENT("recurringCreditAchPayment"), + + RECURRINGDEBITACHPAYMENT("recurringDebitAchPayment"), + + RECURRINGCREDITBOOKPAYMENT("recurringCreditBookPayment"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private List type; + + public static final String SERIALIZED_NAME_FROM_START_TIME = "fromStartTime"; + @SerializedName(SERIALIZED_NAME_FROM_START_TIME) + private String fromStartTime; + + public static final String SERIALIZED_NAME_TO_START_TIME = "toStartTime"; + @SerializedName(SERIALIZED_NAME_TO_START_TIME) + private String toStartTime; + + public static final String SERIALIZED_NAME_FROM_END_TIME = "fromEndTime"; + @SerializedName(SERIALIZED_NAME_FROM_END_TIME) + private String fromEndTime; + + public static final String SERIALIZED_NAME_TO_END_TIME = "toEndTime"; + @SerializedName(SERIALIZED_NAME_TO_END_TIME) + private String toEndTime; + + public ExecuteFilterParameter6() { + } + + public ExecuteFilterParameter6 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter6 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter6 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter6 addStatusItem(String statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter6 type(List type) { + + this.type = type; + return this; + } + + public ExecuteFilterParameter6 addTypeItem(TypeEnum typeItem) { + if (this.type == null) { + this.type = new ArrayList<>(); + } + this.type.add(typeItem); + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public List getType() { + return type; + } + + + public void setType(List type) { + this.type = type; + } + + + public ExecuteFilterParameter6 fromStartTime(String fromStartTime) { + + this.fromStartTime = fromStartTime; + return this; + } + + /** + * Get fromStartTime + * @return fromStartTime + **/ + @javax.annotation.Nullable + public String getFromStartTime() { + return fromStartTime; + } + + + public void setFromStartTime(String fromStartTime) { + this.fromStartTime = fromStartTime; + } + + + public ExecuteFilterParameter6 toStartTime(String toStartTime) { + + this.toStartTime = toStartTime; + return this; + } + + /** + * Get toStartTime + * @return toStartTime + **/ + @javax.annotation.Nullable + public String getToStartTime() { + return toStartTime; + } + + + public void setToStartTime(String toStartTime) { + this.toStartTime = toStartTime; + } + + + public ExecuteFilterParameter6 fromEndTime(String fromEndTime) { + + this.fromEndTime = fromEndTime; + return this; + } + + /** + * Get fromEndTime + * @return fromEndTime + **/ + @javax.annotation.Nullable + public String getFromEndTime() { + return fromEndTime; + } + + + public void setFromEndTime(String fromEndTime) { + this.fromEndTime = fromEndTime; + } + + + public ExecuteFilterParameter6 toEndTime(String toEndTime) { + + this.toEndTime = toEndTime; + return this; + } + + /** + * Get toEndTime + * @return toEndTime + **/ + @javax.annotation.Nullable + public String getToEndTime() { + return toEndTime; + } + + + public void setToEndTime(String toEndTime) { + this.toEndTime = toEndTime; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter6 executeFilterParameter6 = (ExecuteFilterParameter6) o; + return Objects.equals(this.accountId, executeFilterParameter6.accountId) && + Objects.equals(this.customerId, executeFilterParameter6.customerId) && + Objects.equals(this.status, executeFilterParameter6.status) && + Objects.equals(this.type, executeFilterParameter6.type) && + Objects.equals(this.fromStartTime, executeFilterParameter6.fromStartTime) && + Objects.equals(this.toStartTime, executeFilterParameter6.toStartTime) && + Objects.equals(this.fromEndTime, executeFilterParameter6.fromEndTime) && + Objects.equals(this.toEndTime, executeFilterParameter6.toEndTime); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, status, type, fromStartTime, toStartTime, fromEndTime, toEndTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter6 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" fromStartTime: ").append(toIndentedString(fromStartTime)).append("\n"); + sb.append(" toStartTime: ").append(toIndentedString(toStartTime)).append("\n"); + sb.append(" fromEndTime: ").append(toIndentedString(fromEndTime)).append("\n"); + sb.append(" toEndTime: ").append(toIndentedString(toEndTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("fromStartTime"); + openapiFields.add("toStartTime"); + openapiFields.add("fromEndTime"); + openapiFields.add("toEndTime"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter6.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter6 is not found in the empty JSON string", ExecuteFilterParameter6.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter6.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter6` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull() && !jsonObj.get("type").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be an array in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("fromStartTime") != null && !jsonObj.get("fromStartTime").isJsonNull()) && !jsonObj.get("fromStartTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fromStartTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fromStartTime").toString())); + } + if ((jsonObj.get("toStartTime") != null && !jsonObj.get("toStartTime").isJsonNull()) && !jsonObj.get("toStartTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `toStartTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("toStartTime").toString())); + } + if ((jsonObj.get("fromEndTime") != null && !jsonObj.get("fromEndTime").isJsonNull()) && !jsonObj.get("fromEndTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fromEndTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fromEndTime").toString())); + } + if ((jsonObj.get("toEndTime") != null && !jsonObj.get("toEndTime").isJsonNull()) && !jsonObj.get("toEndTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `toEndTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("toEndTime").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter6.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter6 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter6 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter6 + */ + public static ExecuteFilterParameter6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter6.class); + } + + /** + * Convert an instance of ExecuteFilterParameter6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.fromEndTime != null){ + params.add(new Pair("filter[fromEndTime]", this.fromEndTime)); + } + + if(this.toEndTime != null){ + params.add(new Pair("filter[toEndTime]", this.toEndTime)); + } + + if(this.fromStartTime != null){ + params.add(new Pair("filter[fromStartTime]", this.fromStartTime)); + } + + if(this.toStartTime != null){ + params.add(new Pair("filter[toStartTime]", this.toStartTime)); + } + + if(this.type != null){ + int i=0; + for (TypeEnum t:this.type) { + params.add(new Pair(String.format("filter[type][%s]", i), t.getValue())); + i++; + } + } + + if(this.status != null){ + int i=0; + for (String s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s)); + i++; + } + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter7.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter7.java new file mode 100644 index 00000000..34e3ee0e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter7.java @@ -0,0 +1,407 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter7 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter7 { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + INACTIVE("Inactive"), + + ACTIVE("Active"), + + STOLEN("Stolen"), + + LOST("Lost"), + + FROZEN("Frozen"), + + CLOSEDBYCUSTOMER("ClosedByCustomer"), + + SUSPECTEDFRAUD("SuspectedFraud"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public ExecuteFilterParameter7() { + } + + public ExecuteFilterParameter7 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter7 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + public ExecuteFilterParameter7 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter7 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter7 tags(Map tags) { + + this.tags = tags; + return this; + } + + public ExecuteFilterParameter7 putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter7 executeFilterParameter7 = (ExecuteFilterParameter7) o; + return Objects.equals(this.status, executeFilterParameter7.status) && + Objects.equals(this.accountId, executeFilterParameter7.accountId) && + Objects.equals(this.customerId, executeFilterParameter7.customerId) && + Objects.equals(this.tags, executeFilterParameter7.tags); + } + + @Override + public int hashCode() { + return Objects.hash(status, accountId, customerId, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter7 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter7 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter7.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter7 is not found in the empty JSON string", ExecuteFilterParameter7.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter7.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter7` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter7.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter7' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter7.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter7 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter7 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter7 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter7 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter7 + */ + public static ExecuteFilterParameter7 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter7.class); + } + + /** + * Convert an instance of ExecuteFilterParameter7 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.tags != null){ + String tagsAsString = this.tags.keySet().stream() + .map(key -> key + ":" + this.tags.get(key)) + .collect(Collectors.joining(", ", "{", "}")); + params.add(new Pair("filter[tags]", tagsAsString)); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter8.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter8.java new file mode 100644 index 00000000..d23176c3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter8.java @@ -0,0 +1,640 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter8 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter8 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_ACCOUNT_TYPE = "accountType"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_TYPE) + private String accountType; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_CARD_ID = "cardId"; + @SerializedName(SERIALIZED_NAME_CARD_ID) + private String cardId; + + public static final String SERIALIZED_NAME_INCLUDE_NON_AUTHORIZED = "includeNonAuthorized"; + @SerializedName(SERIALIZED_NAME_INCLUDE_NON_AUTHORIZED) + private Boolean includeNonAuthorized; + + public static final String SERIALIZED_NAME_MERCHANT_CATEGORY_CODE = "merchantCategoryCode"; + @SerializedName(SERIALIZED_NAME_MERCHANT_CATEGORY_CODE) + private List merchantCategoryCode; + + public static final String SERIALIZED_NAME_SINCE = "since"; + @SerializedName(SERIALIZED_NAME_SINCE) + private String since; + + public static final String SERIALIZED_NAME_UNTIL = "until"; + @SerializedName(SERIALIZED_NAME_UNTIL) + private String until; + + public static final String SERIALIZED_NAME_FROM_AMOUNT = "fromAmount"; + @SerializedName(SERIALIZED_NAME_FROM_AMOUNT) + private Integer fromAmount; + + public static final String SERIALIZED_NAME_TO_AMOUNT = "toAmount"; + @SerializedName(SERIALIZED_NAME_TO_AMOUNT) + private Integer toAmount; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AUTHORIZED("Authorized"), + + COMPLETED("Completed"), + + CANCELED("Canceled"), + + DECLINED("Declined"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private List status; + + public ExecuteFilterParameter8() { + } + + public ExecuteFilterParameter8 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter8 accountType(String accountType) { + + this.accountType = accountType; + return this; + } + + /** + * Get accountType + * @return accountType + **/ + @javax.annotation.Nullable + public String getAccountType() { + return accountType; + } + + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + + public ExecuteFilterParameter8 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter8 cardId(String cardId) { + + this.cardId = cardId; + return this; + } + + /** + * Get cardId + * @return cardId + **/ + @javax.annotation.Nullable + public String getCardId() { + return cardId; + } + + + public void setCardId(String cardId) { + this.cardId = cardId; + } + + + public ExecuteFilterParameter8 includeNonAuthorized(Boolean includeNonAuthorized) { + + this.includeNonAuthorized = includeNonAuthorized; + return this; + } + + /** + * Get includeNonAuthorized + * @return includeNonAuthorized + **/ + @javax.annotation.Nullable + public Boolean getIncludeNonAuthorized() { + return includeNonAuthorized; + } + + + public void setIncludeNonAuthorized(Boolean includeNonAuthorized) { + this.includeNonAuthorized = includeNonAuthorized; + } + + + public ExecuteFilterParameter8 merchantCategoryCode(List merchantCategoryCode) { + + this.merchantCategoryCode = merchantCategoryCode; + return this; + } + + public ExecuteFilterParameter8 addMerchantCategoryCodeItem(String merchantCategoryCodeItem) { + if (this.merchantCategoryCode == null) { + this.merchantCategoryCode = new ArrayList<>(); + } + this.merchantCategoryCode.add(merchantCategoryCodeItem); + return this; + } + + /** + * Get merchantCategoryCode + * @return merchantCategoryCode + **/ + @javax.annotation.Nullable + public List getMerchantCategoryCode() { + return merchantCategoryCode; + } + + + public void setMerchantCategoryCode(List merchantCategoryCode) { + this.merchantCategoryCode = merchantCategoryCode; + } + + + public ExecuteFilterParameter8 since(String since) { + + this.since = since; + return this; + } + + /** + * Get since + * @return since + **/ + @javax.annotation.Nullable + public String getSince() { + return since; + } + + + public void setSince(String since) { + this.since = since; + } + + + public ExecuteFilterParameter8 until(String until) { + + this.until = until; + return this; + } + + /** + * Get until + * @return until + **/ + @javax.annotation.Nullable + public String getUntil() { + return until; + } + + + public void setUntil(String until) { + this.until = until; + } + + + public ExecuteFilterParameter8 fromAmount(Integer fromAmount) { + + this.fromAmount = fromAmount; + return this; + } + + /** + * Get fromAmount + * @return fromAmount + **/ + @javax.annotation.Nullable + public Integer getFromAmount() { + return fromAmount; + } + + + public void setFromAmount(Integer fromAmount) { + this.fromAmount = fromAmount; + } + + + public ExecuteFilterParameter8 toAmount(Integer toAmount) { + + this.toAmount = toAmount; + return this; + } + + /** + * Get toAmount + * @return toAmount + **/ + @javax.annotation.Nullable + public Integer getToAmount() { + return toAmount; + } + + + public void setToAmount(Integer toAmount) { + this.toAmount = toAmount; + } + + + public ExecuteFilterParameter8 status(List status) { + + this.status = status; + return this; + } + + public ExecuteFilterParameter8 addStatusItem(StatusEnum statusItem) { + if (this.status == null) { + this.status = new ArrayList<>(); + } + this.status.add(statusItem); + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public List getStatus() { + return status; + } + + + public void setStatus(List status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter8 executeFilterParameter8 = (ExecuteFilterParameter8) o; + return Objects.equals(this.accountId, executeFilterParameter8.accountId) && + Objects.equals(this.accountType, executeFilterParameter8.accountType) && + Objects.equals(this.customerId, executeFilterParameter8.customerId) && + Objects.equals(this.cardId, executeFilterParameter8.cardId) && + Objects.equals(this.includeNonAuthorized, executeFilterParameter8.includeNonAuthorized) && + Objects.equals(this.merchantCategoryCode, executeFilterParameter8.merchantCategoryCode) && + Objects.equals(this.since, executeFilterParameter8.since) && + Objects.equals(this.until, executeFilterParameter8.until) && + Objects.equals(this.fromAmount, executeFilterParameter8.fromAmount) && + Objects.equals(this.toAmount, executeFilterParameter8.toAmount) && + Objects.equals(this.status, executeFilterParameter8.status); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, accountType, customerId, cardId, includeNonAuthorized, merchantCategoryCode, since, until, fromAmount, toAmount, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter8 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" accountType: ").append(toIndentedString(accountType)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" cardId: ").append(toIndentedString(cardId)).append("\n"); + sb.append(" includeNonAuthorized: ").append(toIndentedString(includeNonAuthorized)).append("\n"); + sb.append(" merchantCategoryCode: ").append(toIndentedString(merchantCategoryCode)).append("\n"); + sb.append(" since: ").append(toIndentedString(since)).append("\n"); + sb.append(" until: ").append(toIndentedString(until)).append("\n"); + sb.append(" fromAmount: ").append(toIndentedString(fromAmount)).append("\n"); + sb.append(" toAmount: ").append(toIndentedString(toAmount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("accountType"); + openapiFields.add("customerId"); + openapiFields.add("cardId"); + openapiFields.add("includeNonAuthorized"); + openapiFields.add("merchantCategoryCode"); + openapiFields.add("since"); + openapiFields.add("until"); + openapiFields.add("fromAmount"); + openapiFields.add("toAmount"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter8 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter8.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter8 is not found in the empty JSON string", ExecuteFilterParameter8.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter8.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter8` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("accountType") != null && !jsonObj.get("accountType").isJsonNull()) && !jsonObj.get("accountType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountType").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + if ((jsonObj.get("cardId") != null && !jsonObj.get("cardId").isJsonNull()) && !jsonObj.get("cardId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("merchantCategoryCode") != null && !jsonObj.get("merchantCategoryCode").isJsonNull() && !jsonObj.get("merchantCategoryCode").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `merchantCategoryCode` to be an array in the JSON string but got `%s`", jsonObj.get("merchantCategoryCode").toString())); + } + if ((jsonObj.get("since") != null && !jsonObj.get("since").isJsonNull()) && !jsonObj.get("since").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `since` to be a primitive type in the JSON string but got `%s`", jsonObj.get("since").toString())); + } + if ((jsonObj.get("until") != null && !jsonObj.get("until").isJsonNull()) && !jsonObj.get("until").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `until` to be a primitive type in the JSON string but got `%s`", jsonObj.get("until").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull() && !jsonObj.get("status").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be an array in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter8.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter8' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter8.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter8 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter8 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter8 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter8 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter8 + */ + public static ExecuteFilterParameter8 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter8.class); + } + + /** + * Convert an instance of ExecuteFilterParameter8 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.cardId != null){ + params.add(new Pair("filter[cardId]", this.cardId)); + } + + if(this.status != null){ + int i=0; + for (StatusEnum s:this.status) { + params.add(new Pair(String.format("filter[status][%s]", i), s.getValue())); + i++; + } + } + + if(this.fromAmount != null){ + params.add(new Pair("filter[fromAmount]", this.fromAmount.toString())); + } + + if(this.toAmount != null){ + params.add(new Pair("filter[toAmount]", this.toAmount.toString())); + } + + if(this.includeNonAuthorized != null){ + params.add(new Pair("filter[includeNonAuthorized]", this.includeNonAuthorized.toString())); + } + + if(this.accountType != null){ + params.add(new Pair("filter[accountType]", this.accountType)); + } + + if(this.since != null){ + params.add(new Pair("filter[since]", this.since)); + } + + if(this.until != null){ + params.add(new Pair("filter[until]", this.until)); + } + + if(this.merchantCategoryCode != null){ + int i=0; + for (String m:this.merchantCategoryCode) { + params.add(new Pair(String.format("filter[merchantCategoryCode][%s]", i), m)); + i++; + } + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteFilterParameter9.java b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter9.java new file mode 100644 index 00000000..d6883fe0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteFilterParameter9.java @@ -0,0 +1,369 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ExecuteFilterParameter9 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteFilterParameter9 { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CUSTOMER_ID = "customerId"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_ID) + private String customerId; + + public static final String SERIALIZED_NAME_MERCHANT_CATEGORY_CODE = "merchantCategoryCode"; + @SerializedName(SERIALIZED_NAME_MERCHANT_CATEGORY_CODE) + private List merchantCategoryCode; + + public static final String SERIALIZED_NAME_FROM_AMOUNT = "fromAmount"; + @SerializedName(SERIALIZED_NAME_FROM_AMOUNT) + private Integer fromAmount; + + public static final String SERIALIZED_NAME_TO_AMOUNT = "toAmount"; + @SerializedName(SERIALIZED_NAME_TO_AMOUNT) + private Integer toAmount; + + public ExecuteFilterParameter9() { + } + + public ExecuteFilterParameter9 accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ExecuteFilterParameter9 customerId(String customerId) { + + this.customerId = customerId; + return this; + } + + /** + * Get customerId + * @return customerId + **/ + @javax.annotation.Nullable + public String getCustomerId() { + return customerId; + } + + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + + public ExecuteFilterParameter9 merchantCategoryCode(List merchantCategoryCode) { + + this.merchantCategoryCode = merchantCategoryCode; + return this; + } + + public ExecuteFilterParameter9 addMerchantCategoryCodeItem(String merchantCategoryCodeItem) { + if (this.merchantCategoryCode == null) { + this.merchantCategoryCode = new ArrayList<>(); + } + this.merchantCategoryCode.add(merchantCategoryCodeItem); + return this; + } + + /** + * Get merchantCategoryCode + * @return merchantCategoryCode + **/ + @javax.annotation.Nullable + public List getMerchantCategoryCode() { + return merchantCategoryCode; + } + + + public void setMerchantCategoryCode(List merchantCategoryCode) { + this.merchantCategoryCode = merchantCategoryCode; + } + + + public ExecuteFilterParameter9 fromAmount(Integer fromAmount) { + + this.fromAmount = fromAmount; + return this; + } + + /** + * Get fromAmount + * @return fromAmount + **/ + @javax.annotation.Nullable + public Integer getFromAmount() { + return fromAmount; + } + + + public void setFromAmount(Integer fromAmount) { + this.fromAmount = fromAmount; + } + + + public ExecuteFilterParameter9 toAmount(Integer toAmount) { + + this.toAmount = toAmount; + return this; + } + + /** + * Get toAmount + * @return toAmount + **/ + @javax.annotation.Nullable + public Integer getToAmount() { + return toAmount; + } + + + public void setToAmount(Integer toAmount) { + this.toAmount = toAmount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteFilterParameter9 executeFilterParameter9 = (ExecuteFilterParameter9) o; + return Objects.equals(this.accountId, executeFilterParameter9.accountId) && + Objects.equals(this.customerId, executeFilterParameter9.customerId) && + Objects.equals(this.merchantCategoryCode, executeFilterParameter9.merchantCategoryCode) && + Objects.equals(this.fromAmount, executeFilterParameter9.fromAmount) && + Objects.equals(this.toAmount, executeFilterParameter9.toAmount); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, customerId, merchantCategoryCode, fromAmount, toAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteFilterParameter9 {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" customerId: ").append(toIndentedString(customerId)).append("\n"); + sb.append(" merchantCategoryCode: ").append(toIndentedString(merchantCategoryCode)).append("\n"); + sb.append(" fromAmount: ").append(toIndentedString(fromAmount)).append("\n"); + sb.append(" toAmount: ").append(toIndentedString(toAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("customerId"); + openapiFields.add("merchantCategoryCode"); + openapiFields.add("fromAmount"); + openapiFields.add("toAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteFilterParameter9 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteFilterParameter9.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteFilterParameter9 is not found in the empty JSON string", ExecuteFilterParameter9.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteFilterParameter9.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteFilterParameter9` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("customerId") != null && !jsonObj.get("customerId").isJsonNull()) && !jsonObj.get("customerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customerId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("merchantCategoryCode") != null && !jsonObj.get("merchantCategoryCode").isJsonNull() && !jsonObj.get("merchantCategoryCode").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `merchantCategoryCode` to be an array in the JSON string but got `%s`", jsonObj.get("merchantCategoryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteFilterParameter9.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteFilterParameter9' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteFilterParameter9.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteFilterParameter9 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteFilterParameter9 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteFilterParameter9 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteFilterParameter9 + * @throws IOException if the JSON string is invalid with respect to ExecuteFilterParameter9 + */ + public static ExecuteFilterParameter9 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteFilterParameter9.class); + } + + /** + * Convert an instance of ExecuteFilterParameter9 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams(){ + List params = new ArrayList<>(); + + if(this.accountId != null){ + params.add(new Pair("filter[accountId]", this.accountId)); + } + + if(this.customerId != null){ + params.add(new Pair("filter[customerId]", this.customerId)); + } + + if(this.fromAmount != null){ + params.add(new Pair("filter[fromAmount]", this.fromAmount.toString())); + } + + if(this.toAmount != null){ + params.add(new Pair("filter[toAmount]", this.toAmount.toString())); + } + + if(this.merchantCategoryCode != null){ + int i=0; + for (String m:this.merchantCategoryCode) { + params.add(new Pair(String.format("filter[merchantCategoryCode][%s]", i), m)); + i++; + } + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest.java b/src/main/java/org/openapitools/client/model/ExecuteRequest.java new file mode 100644 index 00000000..4ed0b9e2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ExecuteRequestData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ExecuteRequestData data; + + public ExecuteRequest() { + } + + public ExecuteRequest data(ExecuteRequestData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ExecuteRequestData getData() { + return data; + } + + + public void setData(ExecuteRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest executeRequest = (ExecuteRequest) o; + return Objects.equals(this.data, executeRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest is not found in the empty JSON string", ExecuteRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ExecuteRequestData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest + */ + public static ExecuteRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest.class); + } + + /** + * Convert an instance of ExecuteRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest1.java b/src/main/java/org/openapitools/client/model/ExecuteRequest1.java new file mode 100644 index 00000000..51e01e2c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest1.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateApplicationForm; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateApplicationForm data; + + public ExecuteRequest1() { + } + + public ExecuteRequest1 data(CreateApplicationForm data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateApplicationForm getData() { + return data; + } + + + public void setData(CreateApplicationForm data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest1 executeRequest1 = (ExecuteRequest1) o; + return Objects.equals(this.data, executeRequest1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest1 is not found in the empty JSON string", ExecuteRequest1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateApplicationForm.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest1 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest1 + */ + public static ExecuteRequest1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest1.class); + } + + /** + * Convert an instance of ExecuteRequest1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest10.java b/src/main/java/org/openapitools/client/model/ExecuteRequest10.java new file mode 100644 index 00000000..a3d67f26 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest10.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApproveAuthorizationRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest10 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest10 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ApproveAuthorizationRequest data; + + public ExecuteRequest10() { + } + + public ExecuteRequest10 data(ApproveAuthorizationRequest data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ApproveAuthorizationRequest getData() { + return data; + } + + + public void setData(ApproveAuthorizationRequest data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest10 executeRequest10 = (ExecuteRequest10) o; + return Objects.equals(this.data, executeRequest10.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest10 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest10 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest10.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest10 is not found in the empty JSON string", ExecuteRequest10.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest10.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest10` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ApproveAuthorizationRequest.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest10.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest10' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest10.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest10 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest10 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest10 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest10 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest10 + */ + public static ExecuteRequest10 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest10.class); + } + + /** + * Convert an instance of ExecuteRequest10 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest11.java b/src/main/java/org/openapitools/client/model/ExecuteRequest11.java new file mode 100644 index 00000000..2025fc63 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest11.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.DeclineAuthorizationRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest11 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest11 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private DeclineAuthorizationRequest data; + + public ExecuteRequest11() { + } + + public ExecuteRequest11 data(DeclineAuthorizationRequest data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public DeclineAuthorizationRequest getData() { + return data; + } + + + public void setData(DeclineAuthorizationRequest data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest11 executeRequest11 = (ExecuteRequest11) o; + return Objects.equals(this.data, executeRequest11.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest11 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest11 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest11.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest11 is not found in the empty JSON string", ExecuteRequest11.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest11.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest11` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + DeclineAuthorizationRequest.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest11.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest11' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest11.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest11 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest11 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest11 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest11 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest11 + */ + public static ExecuteRequest11 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest11.class); + } + + /** + * Convert an instance of ExecuteRequest11 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest12.java b/src/main/java/org/openapitools/client/model/ExecuteRequest12.java new file mode 100644 index 00000000..e76f99e6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest12.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateReward; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest12 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest12 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateReward data; + + public ExecuteRequest12() { + } + + public ExecuteRequest12 data(CreateReward data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateReward getData() { + return data; + } + + + public void setData(CreateReward data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest12 executeRequest12 = (ExecuteRequest12) o; + return Objects.equals(this.data, executeRequest12.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest12 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest12 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest12.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest12 is not found in the empty JSON string", ExecuteRequest12.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest12.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest12` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateReward.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest12.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest12' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest12.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest12 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest12 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest12 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest12 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest12 + */ + public static ExecuteRequest12 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest12.class); + } + + /** + * Convert an instance of ExecuteRequest12 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest13.java b/src/main/java/org/openapitools/client/model/ExecuteRequest13.java new file mode 100644 index 00000000..f7558e25 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest13.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateFee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest13 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest13 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateFee data; + + public ExecuteRequest13() { + } + + public ExecuteRequest13 data(CreateFee data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateFee getData() { + return data; + } + + + public void setData(CreateFee data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest13 executeRequest13 = (ExecuteRequest13) o; + return Objects.equals(this.data, executeRequest13.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest13 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest13 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest13.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest13 is not found in the empty JSON string", ExecuteRequest13.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest13.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest13` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateFee.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest13.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest13' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest13.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest13 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest13 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest13 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest13 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest13 + */ + public static ExecuteRequest13 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest13.class); + } + + /** + * Convert an instance of ExecuteRequest13 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest14.java b/src/main/java/org/openapitools/client/model/ExecuteRequest14.java new file mode 100644 index 00000000..ff2e46ca --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest14.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCheckDeposit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest14 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest14 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCheckDeposit data; + + public ExecuteRequest14() { + } + + public ExecuteRequest14 data(CreateCheckDeposit data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateCheckDeposit getData() { + return data; + } + + + public void setData(CreateCheckDeposit data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest14 executeRequest14 = (ExecuteRequest14) o; + return Objects.equals(this.data, executeRequest14.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest14 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest14 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest14.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest14 is not found in the empty JSON string", ExecuteRequest14.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest14.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest14` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateCheckDeposit.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest14.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest14' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest14.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest14 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest14 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest14 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest14 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest14 + */ + public static ExecuteRequest14 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest14.class); + } + + /** + * Convert an instance of ExecuteRequest14 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest15.java b/src/main/java/org/openapitools/client/model/ExecuteRequest15.java new file mode 100644 index 00000000..985a8e0d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest15.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateApiToken; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest15 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest15 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateApiToken data; + + public ExecuteRequest15() { + } + + public ExecuteRequest15 data(CreateApiToken data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateApiToken getData() { + return data; + } + + + public void setData(CreateApiToken data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest15 executeRequest15 = (ExecuteRequest15) o; + return Objects.equals(this.data, executeRequest15.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest15 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest15 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest15.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest15 is not found in the empty JSON string", ExecuteRequest15.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest15.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest15` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateApiToken.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest15.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest15' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest15.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest15 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest15 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest15 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest15 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest15 + */ + public static ExecuteRequest15 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest15.class); + } + + /** + * Convert an instance of ExecuteRequest15 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest16.java b/src/main/java/org/openapitools/client/model/ExecuteRequest16.java new file mode 100644 index 00000000..02e39fae --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest16.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCustomerToken; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest16 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest16 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCustomerToken data; + + public ExecuteRequest16() { + } + + public ExecuteRequest16 data(CreateCustomerToken data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateCustomerToken getData() { + return data; + } + + + public void setData(CreateCustomerToken data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest16 executeRequest16 = (ExecuteRequest16) o; + return Objects.equals(this.data, executeRequest16.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest16 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest16 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest16.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest16 is not found in the empty JSON string", ExecuteRequest16.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest16.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest16` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateCustomerToken.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest16.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest16' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest16.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest16 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest16 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest16 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest16 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest16 + */ + public static ExecuteRequest16 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest16.class); + } + + /** + * Convert an instance of ExecuteRequest16 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest17.java b/src/main/java/org/openapitools/client/model/ExecuteRequest17.java new file mode 100644 index 00000000..36df8d61 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest17.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCustomerTokenVerification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest17 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest17 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCustomerTokenVerification data; + + public ExecuteRequest17() { + } + + public ExecuteRequest17 data(CreateCustomerTokenVerification data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateCustomerTokenVerification getData() { + return data; + } + + + public void setData(CreateCustomerTokenVerification data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest17 executeRequest17 = (ExecuteRequest17) o; + return Objects.equals(this.data, executeRequest17.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest17 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest17 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest17.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest17 is not found in the empty JSON string", ExecuteRequest17.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest17.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest17` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateCustomerTokenVerification.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest17.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest17' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest17.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest17 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest17 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest17 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest17 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest17 + */ + public static ExecuteRequest17 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest17.class); + } + + /** + * Convert an instance of ExecuteRequest17 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest18.java b/src/main/java/org/openapitools/client/model/ExecuteRequest18.java new file mode 100644 index 00000000..53e5155d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest18.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateRepayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest18 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest18 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateRepayment data; + + public ExecuteRequest18() { + } + + public ExecuteRequest18 data(CreateRepayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateRepayment getData() { + return data; + } + + + public void setData(CreateRepayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest18 executeRequest18 = (ExecuteRequest18) o; + return Objects.equals(this.data, executeRequest18.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest18 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest18 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest18.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest18 is not found in the empty JSON string", ExecuteRequest18.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest18.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest18` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateRepayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest18.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest18' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest18.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest18 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest18 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest18 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest18 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest18 + */ + public static ExecuteRequest18 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest18.class); + } + + /** + * Convert an instance of ExecuteRequest18 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest19.java b/src/main/java/org/openapitools/client/model/ExecuteRequest19.java new file mode 100644 index 00000000..154b4069 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest19.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCheckPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest19 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest19 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCheckPayment data; + + public ExecuteRequest19() { + } + + public ExecuteRequest19 data(CreateCheckPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateCheckPayment getData() { + return data; + } + + + public void setData(CreateCheckPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest19 executeRequest19 = (ExecuteRequest19) o; + return Objects.equals(this.data, executeRequest19.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest19 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest19 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest19.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest19 is not found in the empty JSON string", ExecuteRequest19.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest19.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest19` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateCheckPayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest19.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest19' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest19.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest19 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest19 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest19 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest19 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest19 + */ + public static ExecuteRequest19 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest19.class); + } + + /** + * Convert an instance of ExecuteRequest19 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest2.java b/src/main/java/org/openapitools/client/model/ExecuteRequest2.java new file mode 100644 index 00000000..e3063814 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest2.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest2 { + public static final String SERIALIZED_NAME_JOB_ID = "jobId"; + @SerializedName(SERIALIZED_NAME_JOB_ID) + private String jobId; + + public ExecuteRequest2() { + } + + public ExecuteRequest2 jobId(String jobId) { + + this.jobId = jobId; + return this; + } + + /** + * Get jobId + * @return jobId + **/ + @javax.annotation.Nullable + public String getJobId() { + return jobId; + } + + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest2 executeRequest2 = (ExecuteRequest2) o; + return Objects.equals(this.jobId, executeRequest2.jobId); + } + + @Override + public int hashCode() { + return Objects.hash(jobId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest2 {\n"); + sb.append(" jobId: ").append(toIndentedString(jobId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("jobId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest2 is not found in the empty JSON string", ExecuteRequest2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("jobId") != null && !jsonObj.get("jobId").isJsonNull()) && !jsonObj.get("jobId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jobId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jobId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest2 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest2 + */ + public static ExecuteRequest2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest2.class); + } + + /** + * Convert an instance of ExecuteRequest2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest20.java b/src/main/java/org/openapitools/client/model/ExecuteRequest20.java new file mode 100644 index 00000000..7c6a5c38 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest20.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ExecuteRequest20Data; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest20 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest20 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ExecuteRequest20Data data; + + public ExecuteRequest20() { + } + + public ExecuteRequest20 data(ExecuteRequest20Data data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ExecuteRequest20Data getData() { + return data; + } + + + public void setData(ExecuteRequest20Data data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest20 executeRequest20 = (ExecuteRequest20) o; + return Objects.equals(this.data, executeRequest20.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest20 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest20 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest20.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest20 is not found in the empty JSON string", ExecuteRequest20.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest20.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest20` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ExecuteRequest20Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest20.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest20' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest20.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest20 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest20 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest20 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest20 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest20 + */ + public static ExecuteRequest20 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest20.class); + } + + /** + * Convert an instance of ExecuteRequest20 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest20Data.java b/src/main/java/org/openapitools/client/model/ExecuteRequest20Data.java new file mode 100644 index 00000000..c22749ad --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest20Data.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest20Data + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest20Data { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "additionalVerification"; + + public ExecuteRequest20Data() { + } + + public ExecuteRequest20Data type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest20Data executeRequest20Data = (ExecuteRequest20Data) o; + return Objects.equals(this.type, executeRequest20Data.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest20Data {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest20Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest20Data.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest20Data is not found in the empty JSON string", ExecuteRequest20Data.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest20Data.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest20Data` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest20Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest20Data' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest20Data.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest20Data value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest20Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest20Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest20Data + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest20Data + */ + public static ExecuteRequest20Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest20Data.class); + } + + /** + * Convert an instance of ExecuteRequest20Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest21.java b/src/main/java/org/openapitools/client/model/ExecuteRequest21.java new file mode 100644 index 00000000..4b975cd6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest21.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ExecuteRequest21Data; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest21 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest21 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ExecuteRequest21Data data; + + public ExecuteRequest21() { + } + + public ExecuteRequest21 data(ExecuteRequest21Data data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ExecuteRequest21Data getData() { + return data; + } + + + public void setData(ExecuteRequest21Data data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest21 executeRequest21 = (ExecuteRequest21) o; + return Objects.equals(this.data, executeRequest21.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest21 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest21 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest21.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest21 is not found in the empty JSON string", ExecuteRequest21.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest21.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest21` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ExecuteRequest21Data.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest21.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest21' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest21.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest21 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest21 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest21 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest21 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest21 + */ + public static ExecuteRequest21 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest21.class); + } + + /** + * Convert an instance of ExecuteRequest21 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest21Data.java b/src/main/java/org/openapitools/client/model/ExecuteRequest21Data.java new file mode 100644 index 00000000..3da53b3a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest21Data.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ExecuteRequest21DataAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest21Data + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest21Data { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "checkPaymentReturn"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ExecuteRequest21DataAttributes attributes; + + public ExecuteRequest21Data() { + } + + public ExecuteRequest21Data type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ExecuteRequest21Data attributes(ExecuteRequest21DataAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public ExecuteRequest21DataAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ExecuteRequest21DataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest21Data executeRequest21Data = (ExecuteRequest21Data) o; + return Objects.equals(this.type, executeRequest21Data.type) && + Objects.equals(this.attributes, executeRequest21Data.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest21Data {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest21Data + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest21Data.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest21Data is not found in the empty JSON string", ExecuteRequest21Data.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest21Data.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest21Data` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + ExecuteRequest21DataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest21Data.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest21Data' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest21Data.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest21Data value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest21Data read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest21Data given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest21Data + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest21Data + */ + public static ExecuteRequest21Data fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest21Data.class); + } + + /** + * Convert an instance of ExecuteRequest21Data to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest21DataAttributes.java b/src/main/java/org/openapitools/client/model/ExecuteRequest21DataAttributes.java new file mode 100644 index 00000000..0f2997dc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest21DataAttributes.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReturnReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest21DataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest21DataAttributes { + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReturnReason reason; + + public ExecuteRequest21DataAttributes() { + } + + public ExecuteRequest21DataAttributes reason(ReturnReason reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public ReturnReason getReason() { + return reason; + } + + + public void setReason(ReturnReason reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest21DataAttributes executeRequest21DataAttributes = (ExecuteRequest21DataAttributes) o; + return Objects.equals(this.reason, executeRequest21DataAttributes.reason); + } + + @Override + public int hashCode() { + return Objects.hash(reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest21DataAttributes {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest21DataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest21DataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest21DataAttributes is not found in the empty JSON string", ExecuteRequest21DataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest21DataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest21DataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest21DataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest21DataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest21DataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest21DataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest21DataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest21DataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest21DataAttributes + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest21DataAttributes + */ + public static ExecuteRequest21DataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest21DataAttributes.class); + } + + /** + * Convert an instance of ExecuteRequest21DataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest3.java b/src/main/java/org/openapitools/client/model/ExecuteRequest3.java new file mode 100644 index 00000000..878c702c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest3.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FreezeAccountRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest3 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest3 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private FreezeAccountRequest data; + + public ExecuteRequest3() { + } + + public ExecuteRequest3 data(FreezeAccountRequest data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public FreezeAccountRequest getData() { + return data; + } + + + public void setData(FreezeAccountRequest data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest3 executeRequest3 = (ExecuteRequest3) o; + return Objects.equals(this.data, executeRequest3.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest3 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest3 is not found in the empty JSON string", ExecuteRequest3.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest3.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest3` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + FreezeAccountRequest.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest3 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest3 + */ + public static ExecuteRequest3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest3.class); + } + + /** + * Convert an instance of ExecuteRequest3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest4.java b/src/main/java/org/openapitools/client/model/ExecuteRequest4.java new file mode 100644 index 00000000..8890e875 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest4.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CloseAccountRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest4 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest4 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CloseAccountRequest data; + + public ExecuteRequest4() { + } + + public ExecuteRequest4 data(CloseAccountRequest data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CloseAccountRequest getData() { + return data; + } + + + public void setData(CloseAccountRequest data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest4 executeRequest4 = (ExecuteRequest4) o; + return Objects.equals(this.data, executeRequest4.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest4 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest4.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest4 is not found in the empty JSON string", ExecuteRequest4.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest4.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest4` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CloseAccountRequest.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest4.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest4 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest4 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest4 + */ + public static ExecuteRequest4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest4.class); + } + + /** + * Convert an instance of ExecuteRequest4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest5.java b/src/main/java/org/openapitools/client/model/ExecuteRequest5.java new file mode 100644 index 00000000..72805e87 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest5.java @@ -0,0 +1,286 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ExecuteRequest5Attributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest5 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest5 { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ARCHIVECUSTOMER("archiveCustomer"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ExecuteRequest5Attributes attributes; + + public ExecuteRequest5() { + } + + public ExecuteRequest5 type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public ExecuteRequest5 attributes(ExecuteRequest5Attributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public ExecuteRequest5Attributes getAttributes() { + return attributes; + } + + + public void setAttributes(ExecuteRequest5Attributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest5 executeRequest5 = (ExecuteRequest5) o; + return Objects.equals(this.type, executeRequest5.type) && + Objects.equals(this.attributes, executeRequest5.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest5 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest5 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest5.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest5 is not found in the empty JSON string", ExecuteRequest5.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest5.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest5` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + ExecuteRequest5Attributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest5.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest5' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest5.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest5 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest5 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest5 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest5 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest5 + */ + public static ExecuteRequest5 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest5.class); + } + + /** + * Convert an instance of ExecuteRequest5 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest5Attributes.java b/src/main/java/org/openapitools/client/model/ExecuteRequest5Attributes.java new file mode 100644 index 00000000..22d1cfb2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest5Attributes.java @@ -0,0 +1,267 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest5Attributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest5Attributes { + /** + * Gets or Sets reason + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + INACTIVE("Inactive"), + + FRAUDACHACTIVITY("FraudACHActivity"), + + FRAUDCARDACTIVITY("FraudCardActivity"), + + FRAUDCHECKACTIVITY("FraudCheckActivity"), + + FRAUDAPPLICATIONHISTORY("FraudApplicationHistory"), + + FRAUDACCOUNTACTIVITY("FraudAccountActivity"), + + FRAUDCLIENTIDENTIFIED("FraudClientIdentified"), + + FRAUDLINKEDTOFRAUDULENTCUSTOMER("FraudLinkedToFraudulentCustomer"); + + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReasonEnum reason; + + public ExecuteRequest5Attributes() { + } + + public ExecuteRequest5Attributes reason(ReasonEnum reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public ReasonEnum getReason() { + return reason; + } + + + public void setReason(ReasonEnum reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest5Attributes executeRequest5Attributes = (ExecuteRequest5Attributes) o; + return Objects.equals(this.reason, executeRequest5Attributes.reason); + } + + @Override + public int hashCode() { + return Objects.hash(reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest5Attributes {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest5Attributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest5Attributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest5Attributes is not found in the empty JSON string", ExecuteRequest5Attributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest5Attributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest5Attributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest5Attributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest5Attributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest5Attributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest5Attributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest5Attributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest5Attributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest5Attributes + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest5Attributes + */ + public static ExecuteRequest5Attributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest5Attributes.class); + } + + /** + * Convert an instance of ExecuteRequest5Attributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest6.java b/src/main/java/org/openapitools/client/model/ExecuteRequest6.java new file mode 100644 index 00000000..358e8afd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest6.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreatePayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest6 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest6 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreatePayment data; + + public ExecuteRequest6() { + } + + public ExecuteRequest6 data(CreatePayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreatePayment getData() { + return data; + } + + + public void setData(CreatePayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest6 executeRequest6 = (ExecuteRequest6) o; + return Objects.equals(this.data, executeRequest6.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest6 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest6.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest6 is not found in the empty JSON string", ExecuteRequest6.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest6.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest6` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreatePayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest6.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest6 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest6 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest6 + */ + public static ExecuteRequest6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest6.class); + } + + /** + * Convert an instance of ExecuteRequest6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest7.java b/src/main/java/org/openapitools/client/model/ExecuteRequest7.java new file mode 100644 index 00000000..137c0cbd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest7.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCounterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest7 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest7 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCounterparty data; + + public ExecuteRequest7() { + } + + public ExecuteRequest7 data(CreateCounterparty data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateCounterparty getData() { + return data; + } + + + public void setData(CreateCounterparty data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest7 executeRequest7 = (ExecuteRequest7) o; + return Objects.equals(this.data, executeRequest7.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest7 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest7 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest7.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest7 is not found in the empty JSON string", ExecuteRequest7.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest7.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest7` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateCounterparty.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest7.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest7' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest7.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest7 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest7 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest7 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest7 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest7 + */ + public static ExecuteRequest7 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest7.class); + } + + /** + * Convert an instance of ExecuteRequest7 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest8.java b/src/main/java/org/openapitools/client/model/ExecuteRequest8.java new file mode 100644 index 00000000..d27da7f0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest8.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateRecurringPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest8 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest8 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateRecurringPayment data; + + public ExecuteRequest8() { + } + + public ExecuteRequest8 data(CreateRecurringPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateRecurringPayment getData() { + return data; + } + + + public void setData(CreateRecurringPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest8 executeRequest8 = (ExecuteRequest8) o; + return Objects.equals(this.data, executeRequest8.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest8 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest8 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest8.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest8 is not found in the empty JSON string", ExecuteRequest8.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest8.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest8` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateRecurringPayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest8.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest8' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest8.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest8 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest8 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest8 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest8 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest8 + */ + public static ExecuteRequest8 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest8.class); + } + + /** + * Convert an instance of ExecuteRequest8 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequest9.java b/src/main/java/org/openapitools/client/model/ExecuteRequest9.java new file mode 100644 index 00000000..1d7e85c7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequest9.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CreateCard; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequest9 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequest9 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CreateCard data; + + public ExecuteRequest9() { + } + + public ExecuteRequest9 data(CreateCard data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CreateCard getData() { + return data; + } + + + public void setData(CreateCard data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequest9 executeRequest9 = (ExecuteRequest9) o; + return Objects.equals(this.data, executeRequest9.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequest9 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequest9 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequest9.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequest9 is not found in the empty JSON string", ExecuteRequest9.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequest9.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequest9` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CreateCard.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequest9.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequest9' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequest9.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequest9 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequest9 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequest9 given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequest9 + * @throws IOException if the JSON string is invalid with respect to ExecuteRequest9 + */ + public static ExecuteRequest9 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequest9.class); + } + + /** + * Convert an instance of ExecuteRequest9 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequestData.java b/src/main/java/org/openapitools/client/model/ExecuteRequestData.java new file mode 100644 index 00000000..d1a0ab5c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequestData.java @@ -0,0 +1,286 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ExecuteRequestDataAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequestData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CANCELAPPLICATION("cancelApplication"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ExecuteRequestDataAttributes attributes; + + public ExecuteRequestData() { + } + + public ExecuteRequestData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public ExecuteRequestData attributes(ExecuteRequestDataAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public ExecuteRequestDataAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ExecuteRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequestData executeRequestData = (ExecuteRequestData) o; + return Objects.equals(this.type, executeRequestData.type) && + Objects.equals(this.attributes, executeRequestData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequestData is not found in the empty JSON string", ExecuteRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + ExecuteRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequestData + * @throws IOException if the JSON string is invalid with respect to ExecuteRequestData + */ + public static ExecuteRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequestData.class); + } + + /** + * Convert an instance of ExecuteRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ExecuteRequestDataAttributes.java b/src/main/java/org/openapitools/client/model/ExecuteRequestDataAttributes.java new file mode 100644 index 00000000..0c62573d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ExecuteRequestDataAttributes.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ExecuteRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecuteRequestDataAttributes { + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public ExecuteRequestDataAttributes() { + } + + public ExecuteRequestDataAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecuteRequestDataAttributes executeRequestDataAttributes = (ExecuteRequestDataAttributes) o; + return Objects.equals(this.reason, executeRequestDataAttributes.reason); + } + + @Override + public int hashCode() { + return Objects.hash(reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecuteRequestDataAttributes {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExecuteRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecuteRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExecuteRequestDataAttributes is not found in the empty JSON string", ExecuteRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExecuteRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExecuteRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecuteRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecuteRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecuteRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecuteRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExecuteRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecuteRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecuteRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to ExecuteRequestDataAttributes + */ + public static ExecuteRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecuteRequestDataAttributes.class); + } + + /** + * Convert an instance of ExecuteRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Fee.java b/src/main/java/org/openapitools/client/model/Fee.java new file mode 100644 index 00000000..451be7d3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Fee.java @@ -0,0 +1,305 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeAttributes; +import org.openapitools.client.model.FeeRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Fee + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Fee { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "fee"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private FeeRelationships relationships; + + public Fee() { + } + + public Fee type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Fee id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Fee attributes(FeeAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public FeeAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeAttributes attributes) { + this.attributes = attributes; + } + + + public Fee relationships(FeeRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public FeeRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(FeeRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Fee fee = (Fee) o; + return Objects.equals(this.type, fee.type) && + Objects.equals(this.id, fee.id) && + Objects.equals(this.attributes, fee.attributes) && + Objects.equals(this.relationships, fee.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Fee {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Fee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Fee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Fee is not found in the empty JSON string", Fee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Fee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Fee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + FeeAttributes.validateJsonElement(jsonObj.get("attributes")); + } + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + FeeRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Fee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Fee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Fee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Fee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Fee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Fee given an JSON string + * + * @param jsonString JSON string + * @return An instance of Fee + * @throws IOException if the JSON string is invalid with respect to Fee + */ + public static Fee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Fee.class); + } + + /** + * Convert an instance of Fee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FeeAttributes.java b/src/main/java/org/openapitools/client/model/FeeAttributes.java new file mode 100644 index 00000000..22ac0a07 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FeeAttributes.java @@ -0,0 +1,274 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FeeAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FeeAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public FeeAttributes() { + } + + public FeeAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public FeeAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public FeeAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeeAttributes feeAttributes = (FeeAttributes) o; + return Objects.equals(this.amount, feeAttributes.amount) && + Objects.equals(this.description, feeAttributes.description) && + Objects.equals(this.tags, feeAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, description, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeeAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeeAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeeAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeeAttributes is not found in the empty JSON string", FeeAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeeAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeeAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeeAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeeAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeeAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeeAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeeAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeeAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FeeAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeeAttributes + * @throws IOException if the JSON string is invalid with respect to FeeAttributes + */ + public static FeeAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeeAttributes.class); + } + + /** + * Convert an instance of FeeAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FeeRelationships.java b/src/main/java/org/openapitools/client/model/FeeRelationships.java new file mode 100644 index 00000000..72c9776d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FeeRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FeeRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FeeRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public FeeRelationships() { + } + + public FeeRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeeRelationships feeRelationships = (FeeRelationships) o; + return Objects.equals(this.account, feeRelationships.account); + } + + @Override + public int hashCode() { + return Objects.hash(account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeeRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeeRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeeRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeeRelationships is not found in the empty JSON string", FeeRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeeRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeeRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeeRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationship.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeeRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeeRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeeRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeeRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeeRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FeeRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeeRelationships + * @throws IOException if the JSON string is invalid with respect to FeeRelationships + */ + public static FeeRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeeRelationships.class); + } + + /** + * Convert an instance of FeeRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FeeTransaction.java b/src/main/java/org/openapitools/client/model/FeeTransaction.java new file mode 100644 index 00000000..aed7adad --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FeeTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FeeTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FeeTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public FeeTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public FeeTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public FeeTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeeTransaction feeTransaction = (FeeTransaction) o; + return Objects.equals(this.attributes, feeTransaction.attributes) && + Objects.equals(this.relationships, feeTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeeTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeeTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeeTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeeTransaction is not found in the empty JSON string", FeeTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeeTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeeTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeeTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeeTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeeTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeeTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeeTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeeTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FeeTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeeTransaction + * @throws IOException if the JSON string is invalid with respect to FeeTransaction + */ + public static FeeTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeeTransaction.class); + } + + /** + * Convert an instance of FeeTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FeeTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/FeeTransactionAllOfAttributes.java new file mode 100644 index 00000000..b3d1d227 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FeeTransactionAllOfAttributes.java @@ -0,0 +1,411 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FeeTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FeeTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public FeeTransactionAllOfAttributes() { + } + + public FeeTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public FeeTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public FeeTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public FeeTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public FeeTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public FeeTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeeTransactionAllOfAttributes feeTransactionAllOfAttributes = (FeeTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, feeTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, feeTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, feeTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, feeTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, feeTransactionAllOfAttributes.summary) && + Objects.equals(this.tags, feeTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeeTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeeTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeeTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeeTransactionAllOfAttributes is not found in the empty JSON string", FeeTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeeTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeeTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeeTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeeTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeeTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeeTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeeTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeeTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FeeTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeeTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to FeeTransactionAllOfAttributes + */ + public static FeeTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeeTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of FeeTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FreezeAccountRequest.java b/src/main/java/org/openapitools/client/model/FreezeAccountRequest.java new file mode 100644 index 00000000..07420c42 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FreezeAccountRequest.java @@ -0,0 +1,288 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FreezeAccountRequestAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FreezeAccountRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FreezeAccountRequest { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CREDITACCOUNTFREEZE("creditAccountFreeze"), + + ACCOUNTFREEZE("accountFreeze"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FreezeAccountRequestAttributes attributes; + + public FreezeAccountRequest() { + } + + public FreezeAccountRequest type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public FreezeAccountRequest attributes(FreezeAccountRequestAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public FreezeAccountRequestAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FreezeAccountRequestAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FreezeAccountRequest freezeAccountRequest = (FreezeAccountRequest) o; + return Objects.equals(this.type, freezeAccountRequest.type) && + Objects.equals(this.attributes, freezeAccountRequest.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreezeAccountRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FreezeAccountRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FreezeAccountRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FreezeAccountRequest is not found in the empty JSON string", FreezeAccountRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FreezeAccountRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FreezeAccountRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + FreezeAccountRequestAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FreezeAccountRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FreezeAccountRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FreezeAccountRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FreezeAccountRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FreezeAccountRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FreezeAccountRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of FreezeAccountRequest + * @throws IOException if the JSON string is invalid with respect to FreezeAccountRequest + */ + public static FreezeAccountRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FreezeAccountRequest.class); + } + + /** + * Convert an instance of FreezeAccountRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FreezeAccountRequestAttributes.java b/src/main/java/org/openapitools/client/model/FreezeAccountRequestAttributes.java new file mode 100644 index 00000000..577dd88f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FreezeAccountRequestAttributes.java @@ -0,0 +1,298 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FreezeAccountRequestAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FreezeAccountRequestAttributes { + /** + * Gets or Sets reason + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + FRAUD("Fraud"), + + OTHER("Other"); + + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private ReasonEnum reason; + + public static final String SERIALIZED_NAME_REASON_TEXT = "reasonText"; + @SerializedName(SERIALIZED_NAME_REASON_TEXT) + private String reasonText; + + public FreezeAccountRequestAttributes() { + } + + public FreezeAccountRequestAttributes reason(ReasonEnum reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public ReasonEnum getReason() { + return reason; + } + + + public void setReason(ReasonEnum reason) { + this.reason = reason; + } + + + public FreezeAccountRequestAttributes reasonText(String reasonText) { + + this.reasonText = reasonText; + return this; + } + + /** + * Get reasonText + * @return reasonText + **/ + @javax.annotation.Nullable + public String getReasonText() { + return reasonText; + } + + + public void setReasonText(String reasonText) { + this.reasonText = reasonText; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FreezeAccountRequestAttributes freezeAccountRequestAttributes = (FreezeAccountRequestAttributes) o; + return Objects.equals(this.reason, freezeAccountRequestAttributes.reason) && + Objects.equals(this.reasonText, freezeAccountRequestAttributes.reasonText); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(reason, reasonText); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreezeAccountRequestAttributes {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" reasonText: ").append(toIndentedString(reasonText)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + openapiFields.add("reasonText"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FreezeAccountRequestAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FreezeAccountRequestAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FreezeAccountRequestAttributes is not found in the empty JSON string", FreezeAccountRequestAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FreezeAccountRequestAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FreezeAccountRequestAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("reasonText") != null && !jsonObj.get("reasonText").isJsonNull()) && !jsonObj.get("reasonText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reasonText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasonText").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FreezeAccountRequestAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FreezeAccountRequestAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FreezeAccountRequestAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FreezeAccountRequestAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FreezeAccountRequestAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FreezeAccountRequestAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of FreezeAccountRequestAttributes + * @throws IOException if the JSON string is invalid with respect to FreezeAccountRequestAttributes + */ + public static FreezeAccountRequestAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FreezeAccountRequestAttributes.class); + } + + /** + * Convert an instance of FreezeAccountRequestAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/FullName.java b/src/main/java/org/openapitools/client/model/FullName.java new file mode 100644 index 00000000..4b0155d9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/FullName.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FullName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FullName { + public static final String SERIALIZED_NAME_FIRST = "first"; + @SerializedName(SERIALIZED_NAME_FIRST) + private String first; + + public static final String SERIALIZED_NAME_LAST = "last"; + @SerializedName(SERIALIZED_NAME_LAST) + private String last; + + public FullName() { + } + + public FullName first(String first) { + + this.first = first; + return this; + } + + /** + * Get first + * @return first + **/ + @javax.annotation.Nonnull + public String getFirst() { + return first; + } + + + public void setFirst(String first) { + this.first = first; + } + + + public FullName last(String last) { + + this.last = last; + return this; + } + + /** + * Get last + * @return last + **/ + @javax.annotation.Nonnull + public String getLast() { + return last; + } + + + public void setLast(String last) { + this.last = last; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FullName fullName = (FullName) o; + return Objects.equals(this.first, fullName.first) && + Objects.equals(this.last, fullName.last); + } + + @Override + public int hashCode() { + return Objects.hash(first, last); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FullName {\n"); + sb.append(" first: ").append(toIndentedString(first)).append("\n"); + sb.append(" last: ").append(toIndentedString(last)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("first"); + openapiFields.add("last"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("first"); + openapiRequiredFields.add("last"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FullName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FullName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FullName is not found in the empty JSON string", FullName.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FullName.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FullName` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FullName.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("first").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `first` to be a primitive type in the JSON string but got `%s`", jsonObj.get("first").toString())); + } + if (!jsonObj.get("last").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FullName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FullName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FullName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FullName value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FullName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FullName given an JSON string + * + * @param jsonString JSON string + * @return An instance of FullName + * @throws IOException if the JSON string is invalid with respect to FullName + */ + public static FullName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FullName.class); + } + + /** + * Convert an instance of FullName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Grantor.java b/src/main/java/org/openapitools/client/model/Grantor.java new file mode 100644 index 00000000..520b5b1f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Grantor.java @@ -0,0 +1,601 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Grantor + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Grantor { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_MASKED_S_S_N = "maskedSSN"; + @SerializedName(SERIALIZED_NAME_MASKED_S_S_N) + private String maskedSSN; + + public Grantor() { + } + + public Grantor fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Grantor email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Grantor phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public Grantor ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public Grantor passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public Grantor matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public Grantor nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public Grantor address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public Grantor dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public Grantor evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public Grantor evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public Grantor addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public Grantor status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public Grantor maskedSSN(String maskedSSN) { + + this.maskedSSN = maskedSSN; + return this; + } + + /** + * Get maskedSSN + * @return maskedSSN + **/ + @javax.annotation.Nullable + public String getMaskedSSN() { + return maskedSSN; + } + + + public void setMaskedSSN(String maskedSSN) { + this.maskedSSN = maskedSSN; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Grantor grantor = (Grantor) o; + return Objects.equals(this.fullName, grantor.fullName) && + Objects.equals(this.email, grantor.email) && + Objects.equals(this.phone, grantor.phone) && + Objects.equals(this.ssn, grantor.ssn) && + Objects.equals(this.passport, grantor.passport) && + Objects.equals(this.matriculaConsular, grantor.matriculaConsular) && + Objects.equals(this.nationality, grantor.nationality) && + Objects.equals(this.address, grantor.address) && + Objects.equals(this.dateOfBirth, grantor.dateOfBirth) && + Objects.equals(this.evaluationId, grantor.evaluationId) && + Objects.equals(this.evaluationFlags, grantor.evaluationFlags) && + Objects.equals(this.status, grantor.status) && + Objects.equals(this.maskedSSN, grantor.maskedSSN); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, matriculaConsular, nationality, address, dateOfBirth, evaluationId, evaluationFlags, status, maskedSSN); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Grantor {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" maskedSSN: ").append(toIndentedString(maskedSSN)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("matriculaConsular"); + openapiFields.add("nationality"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("evaluationId"); + openapiFields.add("evaluationFlags"); + openapiFields.add("status"); + openapiFields.add("maskedSSN"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Grantor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Grantor.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Grantor is not found in the empty JSON string", Grantor.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Grantor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Grantor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Grantor.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("maskedSSN") != null && !jsonObj.get("maskedSSN").isJsonNull()) && !jsonObj.get("maskedSSN").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedSSN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedSSN").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Grantor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Grantor' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Grantor.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Grantor value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Grantor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Grantor given an JSON string + * + * @param jsonString JSON string + * @return An instance of Grantor + * @throws IOException if the JSON string is invalid with respect to Grantor + */ + public static Grantor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Grantor.class); + } + + /** + * Convert an instance of Grantor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/HealthcareAmounts.java b/src/main/java/org/openapitools/client/model/HealthcareAmounts.java new file mode 100644 index 00000000..70346c7f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/HealthcareAmounts.java @@ -0,0 +1,358 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HealthcareAmounts + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HealthcareAmounts { + public static final String SERIALIZED_NAME_TRANSIT_AMOUNT = "transitAmount"; + @SerializedName(SERIALIZED_NAME_TRANSIT_AMOUNT) + private Integer transitAmount; + + public static final String SERIALIZED_NAME_PRESCRIPTION_R_X_AMOUNT = "prescriptionRXAmount"; + @SerializedName(SERIALIZED_NAME_PRESCRIPTION_R_X_AMOUNT) + private Integer prescriptionRXAmount; + + public static final String SERIALIZED_NAME_VISION_OPTICAL_AMOUNT = "visionOpticalAmount"; + @SerializedName(SERIALIZED_NAME_VISION_OPTICAL_AMOUNT) + private Integer visionOpticalAmount; + + public static final String SERIALIZED_NAME_CLINIC_OTHER_QUALIFIED_MEDICAL_AMOUNT = "clinicOtherQualifiedMedicalAmount"; + @SerializedName(SERIALIZED_NAME_CLINIC_OTHER_QUALIFIED_MEDICAL_AMOUNT) + private Integer clinicOtherQualifiedMedicalAmount; + + public static final String SERIALIZED_NAME_DENTAL_AMOUNT = "dentalAmount"; + @SerializedName(SERIALIZED_NAME_DENTAL_AMOUNT) + private Integer dentalAmount; + + public static final String SERIALIZED_NAME_TOTAL_HEALTHCARE_AMOUNT = "totalHealthcareAmount"; + @SerializedName(SERIALIZED_NAME_TOTAL_HEALTHCARE_AMOUNT) + private Integer totalHealthcareAmount; + + public HealthcareAmounts() { + } + + public HealthcareAmounts transitAmount(Integer transitAmount) { + + this.transitAmount = transitAmount; + return this; + } + + /** + * Get transitAmount + * @return transitAmount + **/ + @javax.annotation.Nonnull + public Integer getTransitAmount() { + return transitAmount; + } + + + public void setTransitAmount(Integer transitAmount) { + this.transitAmount = transitAmount; + } + + + public HealthcareAmounts prescriptionRXAmount(Integer prescriptionRXAmount) { + + this.prescriptionRXAmount = prescriptionRXAmount; + return this; + } + + /** + * Get prescriptionRXAmount + * @return prescriptionRXAmount + **/ + @javax.annotation.Nonnull + public Integer getPrescriptionRXAmount() { + return prescriptionRXAmount; + } + + + public void setPrescriptionRXAmount(Integer prescriptionRXAmount) { + this.prescriptionRXAmount = prescriptionRXAmount; + } + + + public HealthcareAmounts visionOpticalAmount(Integer visionOpticalAmount) { + + this.visionOpticalAmount = visionOpticalAmount; + return this; + } + + /** + * Get visionOpticalAmount + * @return visionOpticalAmount + **/ + @javax.annotation.Nonnull + public Integer getVisionOpticalAmount() { + return visionOpticalAmount; + } + + + public void setVisionOpticalAmount(Integer visionOpticalAmount) { + this.visionOpticalAmount = visionOpticalAmount; + } + + + public HealthcareAmounts clinicOtherQualifiedMedicalAmount(Integer clinicOtherQualifiedMedicalAmount) { + + this.clinicOtherQualifiedMedicalAmount = clinicOtherQualifiedMedicalAmount; + return this; + } + + /** + * Get clinicOtherQualifiedMedicalAmount + * @return clinicOtherQualifiedMedicalAmount + **/ + @javax.annotation.Nonnull + public Integer getClinicOtherQualifiedMedicalAmount() { + return clinicOtherQualifiedMedicalAmount; + } + + + public void setClinicOtherQualifiedMedicalAmount(Integer clinicOtherQualifiedMedicalAmount) { + this.clinicOtherQualifiedMedicalAmount = clinicOtherQualifiedMedicalAmount; + } + + + public HealthcareAmounts dentalAmount(Integer dentalAmount) { + + this.dentalAmount = dentalAmount; + return this; + } + + /** + * Get dentalAmount + * @return dentalAmount + **/ + @javax.annotation.Nonnull + public Integer getDentalAmount() { + return dentalAmount; + } + + + public void setDentalAmount(Integer dentalAmount) { + this.dentalAmount = dentalAmount; + } + + + public HealthcareAmounts totalHealthcareAmount(Integer totalHealthcareAmount) { + + this.totalHealthcareAmount = totalHealthcareAmount; + return this; + } + + /** + * Get totalHealthcareAmount + * @return totalHealthcareAmount + **/ + @javax.annotation.Nonnull + public Integer getTotalHealthcareAmount() { + return totalHealthcareAmount; + } + + + public void setTotalHealthcareAmount(Integer totalHealthcareAmount) { + this.totalHealthcareAmount = totalHealthcareAmount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthcareAmounts healthcareAmounts = (HealthcareAmounts) o; + return Objects.equals(this.transitAmount, healthcareAmounts.transitAmount) && + Objects.equals(this.prescriptionRXAmount, healthcareAmounts.prescriptionRXAmount) && + Objects.equals(this.visionOpticalAmount, healthcareAmounts.visionOpticalAmount) && + Objects.equals(this.clinicOtherQualifiedMedicalAmount, healthcareAmounts.clinicOtherQualifiedMedicalAmount) && + Objects.equals(this.dentalAmount, healthcareAmounts.dentalAmount) && + Objects.equals(this.totalHealthcareAmount, healthcareAmounts.totalHealthcareAmount); + } + + @Override + public int hashCode() { + return Objects.hash(transitAmount, prescriptionRXAmount, visionOpticalAmount, clinicOtherQualifiedMedicalAmount, dentalAmount, totalHealthcareAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthcareAmounts {\n"); + sb.append(" transitAmount: ").append(toIndentedString(transitAmount)).append("\n"); + sb.append(" prescriptionRXAmount: ").append(toIndentedString(prescriptionRXAmount)).append("\n"); + sb.append(" visionOpticalAmount: ").append(toIndentedString(visionOpticalAmount)).append("\n"); + sb.append(" clinicOtherQualifiedMedicalAmount: ").append(toIndentedString(clinicOtherQualifiedMedicalAmount)).append("\n"); + sb.append(" dentalAmount: ").append(toIndentedString(dentalAmount)).append("\n"); + sb.append(" totalHealthcareAmount: ").append(toIndentedString(totalHealthcareAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transitAmount"); + openapiFields.add("prescriptionRXAmount"); + openapiFields.add("visionOpticalAmount"); + openapiFields.add("clinicOtherQualifiedMedicalAmount"); + openapiFields.add("dentalAmount"); + openapiFields.add("totalHealthcareAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("transitAmount"); + openapiRequiredFields.add("prescriptionRXAmount"); + openapiRequiredFields.add("visionOpticalAmount"); + openapiRequiredFields.add("clinicOtherQualifiedMedicalAmount"); + openapiRequiredFields.add("dentalAmount"); + openapiRequiredFields.add("totalHealthcareAmount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HealthcareAmounts + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HealthcareAmounts.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HealthcareAmounts is not found in the empty JSON string", HealthcareAmounts.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HealthcareAmounts.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HealthcareAmounts` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HealthcareAmounts.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HealthcareAmounts.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HealthcareAmounts' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HealthcareAmounts.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HealthcareAmounts value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HealthcareAmounts read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HealthcareAmounts given an JSON string + * + * @param jsonString JSON string + * @return An instance of HealthcareAmounts + * @throws IOException if the JSON string is invalid with respect to HealthcareAmounts + */ + public static HealthcareAmounts fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HealthcareAmounts.class); + } + + /** + * Convert an instance of HealthcareAmounts to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IncludedResourceInner.java b/src/main/java/org/openapitools/client/model/IncludedResourceInner.java new file mode 100644 index 00000000..cf67b4ce --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IncludedResourceInner.java @@ -0,0 +1,295 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IncludedResourceInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IncludedResourceInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private Object attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private Object relationships; + + public IncludedResourceInner() { + } + + public IncludedResourceInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public IncludedResourceInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public IncludedResourceInner attributes(Object attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public Object getAttributes() { + return attributes; + } + + + public void setAttributes(Object attributes) { + this.attributes = attributes; + } + + + public IncludedResourceInner relationships(Object relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public Object getRelationships() { + return relationships; + } + + + public void setRelationships(Object relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncludedResourceInner includedResourceInner = (IncludedResourceInner) o; + return Objects.equals(this.id, includedResourceInner.id) && + Objects.equals(this.type, includedResourceInner.type) && + Objects.equals(this.attributes, includedResourceInner.attributes) && + Objects.equals(this.relationships, includedResourceInner.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncludedResourceInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IncludedResourceInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IncludedResourceInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IncludedResourceInner is not found in the empty JSON string", IncludedResourceInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IncludedResourceInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IncludedResourceInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IncludedResourceInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IncludedResourceInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IncludedResourceInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IncludedResourceInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IncludedResourceInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IncludedResourceInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of IncludedResourceInner + * @throws IOException if the JSON string is invalid with respect to IncludedResourceInner + */ + public static IncludedResourceInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IncludedResourceInner.class); + } + + /** + * Convert an instance of IncludedResourceInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IncomingAchRelationship.java b/src/main/java/org/openapitools/client/model/IncomingAchRelationship.java new file mode 100644 index 00000000..9d42982e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IncomingAchRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.IncomingAchRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IncomingAchRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IncomingAchRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private IncomingAchRelationshipData data; + + public IncomingAchRelationship() { + } + + public IncomingAchRelationship data(IncomingAchRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public IncomingAchRelationshipData getData() { + return data; + } + + + public void setData(IncomingAchRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncomingAchRelationship incomingAchRelationship = (IncomingAchRelationship) o; + return Objects.equals(this.data, incomingAchRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncomingAchRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IncomingAchRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IncomingAchRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IncomingAchRelationship is not found in the empty JSON string", IncomingAchRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IncomingAchRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IncomingAchRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IncomingAchRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + IncomingAchRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IncomingAchRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IncomingAchRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IncomingAchRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IncomingAchRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IncomingAchRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IncomingAchRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of IncomingAchRelationship + * @throws IOException if the JSON string is invalid with respect to IncomingAchRelationship + */ + public static IncomingAchRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IncomingAchRelationship.class); + } + + /** + * Convert an instance of IncomingAchRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IncomingAchRelationshipData.java b/src/main/java/org/openapitools/client/model/IncomingAchRelationshipData.java new file mode 100644 index 00000000..18bb87fb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IncomingAchRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IncomingAchRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IncomingAchRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "incomingAch"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public IncomingAchRelationshipData() { + } + + public IncomingAchRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public IncomingAchRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncomingAchRelationshipData incomingAchRelationshipData = (IncomingAchRelationshipData) o; + return Objects.equals(this.type, incomingAchRelationshipData.type) && + Objects.equals(this.id, incomingAchRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncomingAchRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IncomingAchRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IncomingAchRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IncomingAchRelationshipData is not found in the empty JSON string", IncomingAchRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IncomingAchRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IncomingAchRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IncomingAchRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IncomingAchRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IncomingAchRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IncomingAchRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IncomingAchRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IncomingAchRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IncomingAchRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of IncomingAchRelationshipData + * @throws IOException if the JSON string is invalid with respect to IncomingAchRelationshipData + */ + public static IncomingAchRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IncomingAchRelationshipData.class); + } + + /** + * Convert an instance of IncomingAchRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualApplication.java b/src/main/java/org/openapitools/client/model/IndividualApplication.java new file mode 100644 index 00000000..ffc98166 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualApplication.java @@ -0,0 +1,250 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.ApplicationRelationships; +import org.openapitools.client.model.IndividualApplicationAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualApplication extends Application { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private IndividualApplicationAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private ApplicationRelationships relationships; + + public IndividualApplication() { + this.type = this.getClass().getSimpleName(); + } + + public IndividualApplication attributes(IndividualApplicationAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public IndividualApplicationAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(IndividualApplicationAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public IndividualApplication relationships(ApplicationRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public ApplicationRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(ApplicationRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualApplication individualApplication = (IndividualApplication) o; + return Objects.equals(this.attributes, individualApplication.attributes) && + Objects.equals(this.relationships, individualApplication.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualApplication {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualApplication is not found in the empty JSON string", IndividualApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualApplication + * @throws IOException if the JSON string is invalid with respect to IndividualApplication + */ + public static IndividualApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualApplication.class); + } + + /** + * Convert an instance of IndividualApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualApplicationAllOfAttributes.java b/src/main/java/org/openapitools/client/model/IndividualApplicationAllOfAttributes.java new file mode 100644 index 00000000..375720d4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualApplicationAllOfAttributes.java @@ -0,0 +1,1655 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.ApplicationStatus; +import org.openapitools.client.model.BusinessVertical; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Industry; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.PowerOfAttorneyAgent; +import org.openapitools.client.model.SoleProprietorshipAnnualRevenue; +import org.openapitools.client.model.SoleProprietorshipNumberOfEmployees; +import org.openapitools.client.model.SourceOfIncome; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualApplicationAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualApplicationAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private ApplicationStatus status; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_EVALUATION_OUTCOME = "evaluationOutcome"; + @SerializedName(SERIALIZED_NAME_EVALUATION_OUTCOME) + private String evaluationOutcome; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_EVALUATION_ENTITY_ID = "evaluationEntityId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ENTITY_ID) + private String evaluationEntityId; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Object address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + public static final String SERIALIZED_NAME_SOLE_PROPRIETORSHIP = "soleProprietorship"; + @SerializedName(SERIALIZED_NAME_SOLE_PROPRIETORSHIP) + private Boolean soleProprietorship; + + /** + * Gets or Sets decisionMethod + */ + @JsonAdapter(DecisionMethodEnum.Adapter.class) + public enum DecisionMethodEnum { + MANUALLY("Manually"), + + AUTOMATICALLY("Automatically"); + + private String value; + + DecisionMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DecisionMethodEnum fromValue(String value) { + for (DecisionMethodEnum b : DecisionMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DecisionMethodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DecisionMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DecisionMethodEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DECISION_METHOD = "decisionMethod"; + @SerializedName(SERIALIZED_NAME_DECISION_METHOD) + private DecisionMethodEnum decisionMethod; + + public static final String SERIALIZED_NAME_DECISION_USER_ID = "decisionUserId"; + @SerializedName(SERIALIZED_NAME_DECISION_USER_ID) + private String decisionUserId; + + public static final String SERIALIZED_NAME_DECISION_REASON = "decisionReason"; + @SerializedName(SERIALIZED_NAME_DECISION_REASON) + private String decisionReason; + + public static final String SERIALIZED_NAME_DECISION_DATE_TIME = "decisionDateTime"; + @SerializedName(SERIALIZED_NAME_DECISION_DATE_TIME) + private OffsetDateTime decisionDateTime; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets riskRate + */ + @JsonAdapter(RiskRateEnum.Adapter.class) + public enum RiskRateEnum { + LOW("low"), + + MEDIUM("medium"), + + HIGH("high"); + + private String value; + + RiskRateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RiskRateEnum fromValue(String value) { + for (RiskRateEnum b : RiskRateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RiskRateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RiskRateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RiskRateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RISK_RATE = "riskRate"; + @SerializedName(SERIALIZED_NAME_RISK_RATE) + private RiskRateEnum riskRate; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_EVALUATION_SCORES = "evaluationScores"; + @SerializedName(SERIALIZED_NAME_EVALUATION_SCORES) + private Object evaluationScores; + + public static final String SERIALIZED_NAME_IP_LOCATION_DETAILS = "ipLocationDetails"; + @SerializedName(SERIALIZED_NAME_IP_LOCATION_DETAILS) + private Object ipLocationDetails; + + public static final String SERIALIZED_NAME_PHONE_LOCATION_DETAILS = "phoneLocationDetails"; + @SerializedName(SERIALIZED_NAME_PHONE_LOCATION_DETAILS) + private Object phoneLocationDetails; + + public static final String SERIALIZED_NAME_MASKED_S_S_N = "maskedSSN"; + @SerializedName(SERIALIZED_NAME_MASKED_S_S_N) + private String maskedSSN; + + public static final String SERIALIZED_NAME_MASKED_PASSPORT = "maskedPassport"; + @SerializedName(SERIALIZED_NAME_MASKED_PASSPORT) + private String maskedPassport; + + public static final String SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR = "maskedMatriculaConsular"; + @SerializedName(SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR) + private String maskedMatriculaConsular; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public static final String SERIALIZED_NAME_ARCHIVED = "archived"; + @SerializedName(SERIALIZED_NAME_ARCHIVED) + private Boolean archived; + + public static final String SERIALIZED_NAME_POWER_OF_ATTORNEY_AGENT = "powerOfAttorneyAgent"; + @SerializedName(SERIALIZED_NAME_POWER_OF_ATTORNEY_AGENT) + private PowerOfAttorneyAgent powerOfAttorneyAgent; + + public static final String SERIALIZED_NAME_INDUSTRY = "industry"; + @SerializedName(SERIALIZED_NAME_INDUSTRY) + private Industry industry; + + public static final String SERIALIZED_NAME_ID_THEFT_SCORE = "idTheftScore"; + @SerializedName(SERIALIZED_NAME_ID_THEFT_SCORE) + private Integer idTheftScore; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public static final String SERIALIZED_NAME_ANNUAL_REVENUE = "annualRevenue"; + @SerializedName(SERIALIZED_NAME_ANNUAL_REVENUE) + private SoleProprietorshipAnnualRevenue annualRevenue; + + public static final String SERIALIZED_NAME_NUMBER_OF_EMPLOYEES = "numberOfEmployees"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_EMPLOYEES) + private SoleProprietorshipNumberOfEmployees numberOfEmployees; + + public static final String SERIALIZED_NAME_BUSINESS_VERTICAL = "businessVertical"; + @SerializedName(SERIALIZED_NAME_BUSINESS_VERTICAL) + private BusinessVertical businessVertical; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; + + public IndividualApplicationAllOfAttributes() { + } + + public IndividualApplicationAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public IndividualApplicationAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public IndividualApplicationAllOfAttributes status(ApplicationStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public ApplicationStatus getStatus() { + return status; + } + + + public void setStatus(ApplicationStatus status) { + this.status = status; + } + + + public IndividualApplicationAllOfAttributes message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public IndividualApplicationAllOfAttributes evaluationOutcome(String evaluationOutcome) { + + this.evaluationOutcome = evaluationOutcome; + return this; + } + + /** + * Get evaluationOutcome + * @return evaluationOutcome + **/ + @javax.annotation.Nullable + public String getEvaluationOutcome() { + return evaluationOutcome; + } + + + public void setEvaluationOutcome(String evaluationOutcome) { + this.evaluationOutcome = evaluationOutcome; + } + + + public IndividualApplicationAllOfAttributes evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public IndividualApplicationAllOfAttributes evaluationEntityId(String evaluationEntityId) { + + this.evaluationEntityId = evaluationEntityId; + return this; + } + + /** + * Get evaluationEntityId + * @return evaluationEntityId + **/ + @javax.annotation.Nullable + public String getEvaluationEntityId() { + return evaluationEntityId; + } + + + public void setEvaluationEntityId(String evaluationEntityId) { + this.evaluationEntityId = evaluationEntityId; + } + + + public IndividualApplicationAllOfAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public IndividualApplicationAllOfAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public IndividualApplicationAllOfAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public IndividualApplicationAllOfAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public IndividualApplicationAllOfAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public IndividualApplicationAllOfAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public IndividualApplicationAllOfAttributes matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public IndividualApplicationAllOfAttributes address(Object address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Object getAddress() { + return address; + } + + + public void setAddress(Object address) { + this.address = address; + } + + + public IndividualApplicationAllOfAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public IndividualApplicationAllOfAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public IndividualApplicationAllOfAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public IndividualApplicationAllOfAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public IndividualApplicationAllOfAttributes soleProprietorship(Boolean soleProprietorship) { + + this.soleProprietorship = soleProprietorship; + return this; + } + + /** + * Get soleProprietorship + * @return soleProprietorship + **/ + @javax.annotation.Nullable + public Boolean getSoleProprietorship() { + return soleProprietorship; + } + + + public void setSoleProprietorship(Boolean soleProprietorship) { + this.soleProprietorship = soleProprietorship; + } + + + public IndividualApplicationAllOfAttributes decisionMethod(DecisionMethodEnum decisionMethod) { + + this.decisionMethod = decisionMethod; + return this; + } + + /** + * Get decisionMethod + * @return decisionMethod + **/ + @javax.annotation.Nullable + public DecisionMethodEnum getDecisionMethod() { + return decisionMethod; + } + + + public void setDecisionMethod(DecisionMethodEnum decisionMethod) { + this.decisionMethod = decisionMethod; + } + + + public IndividualApplicationAllOfAttributes decisionUserId(String decisionUserId) { + + this.decisionUserId = decisionUserId; + return this; + } + + /** + * Get decisionUserId + * @return decisionUserId + **/ + @javax.annotation.Nullable + public String getDecisionUserId() { + return decisionUserId; + } + + + public void setDecisionUserId(String decisionUserId) { + this.decisionUserId = decisionUserId; + } + + + public IndividualApplicationAllOfAttributes decisionReason(String decisionReason) { + + this.decisionReason = decisionReason; + return this; + } + + /** + * Get decisionReason + * @return decisionReason + **/ + @javax.annotation.Nullable + public String getDecisionReason() { + return decisionReason; + } + + + public void setDecisionReason(String decisionReason) { + this.decisionReason = decisionReason; + } + + + public IndividualApplicationAllOfAttributes decisionDateTime(OffsetDateTime decisionDateTime) { + + this.decisionDateTime = decisionDateTime; + return this; + } + + /** + * Get decisionDateTime + * @return decisionDateTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getDecisionDateTime() { + return decisionDateTime; + } + + + public void setDecisionDateTime(OffsetDateTime decisionDateTime) { + this.decisionDateTime = decisionDateTime; + } + + + public IndividualApplicationAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public IndividualApplicationAllOfAttributes riskRate(RiskRateEnum riskRate) { + + this.riskRate = riskRate; + return this; + } + + /** + * Get riskRate + * @return riskRate + **/ + @javax.annotation.Nullable + public RiskRateEnum getRiskRate() { + return riskRate; + } + + + public void setRiskRate(RiskRateEnum riskRate) { + this.riskRate = riskRate; + } + + + public IndividualApplicationAllOfAttributes evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public IndividualApplicationAllOfAttributes addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public IndividualApplicationAllOfAttributes evaluationScores(Object evaluationScores) { + + this.evaluationScores = evaluationScores; + return this; + } + + /** + * Get evaluationScores + * @return evaluationScores + **/ + @javax.annotation.Nullable + public Object getEvaluationScores() { + return evaluationScores; + } + + + public void setEvaluationScores(Object evaluationScores) { + this.evaluationScores = evaluationScores; + } + + + public IndividualApplicationAllOfAttributes ipLocationDetails(Object ipLocationDetails) { + + this.ipLocationDetails = ipLocationDetails; + return this; + } + + /** + * Get ipLocationDetails + * @return ipLocationDetails + **/ + @javax.annotation.Nullable + public Object getIpLocationDetails() { + return ipLocationDetails; + } + + + public void setIpLocationDetails(Object ipLocationDetails) { + this.ipLocationDetails = ipLocationDetails; + } + + + public IndividualApplicationAllOfAttributes phoneLocationDetails(Object phoneLocationDetails) { + + this.phoneLocationDetails = phoneLocationDetails; + return this; + } + + /** + * Get phoneLocationDetails + * @return phoneLocationDetails + **/ + @javax.annotation.Nullable + public Object getPhoneLocationDetails() { + return phoneLocationDetails; + } + + + public void setPhoneLocationDetails(Object phoneLocationDetails) { + this.phoneLocationDetails = phoneLocationDetails; + } + + + public IndividualApplicationAllOfAttributes maskedSSN(String maskedSSN) { + + this.maskedSSN = maskedSSN; + return this; + } + + /** + * Get maskedSSN + * @return maskedSSN + **/ + @javax.annotation.Nullable + public String getMaskedSSN() { + return maskedSSN; + } + + + public void setMaskedSSN(String maskedSSN) { + this.maskedSSN = maskedSSN; + } + + + public IndividualApplicationAllOfAttributes maskedPassport(String maskedPassport) { + + this.maskedPassport = maskedPassport; + return this; + } + + /** + * Get maskedPassport + * @return maskedPassport + **/ + @javax.annotation.Nullable + public String getMaskedPassport() { + return maskedPassport; + } + + + public void setMaskedPassport(String maskedPassport) { + this.maskedPassport = maskedPassport; + } + + + public IndividualApplicationAllOfAttributes maskedMatriculaConsular(String maskedMatriculaConsular) { + + this.maskedMatriculaConsular = maskedMatriculaConsular; + return this; + } + + /** + * Get maskedMatriculaConsular + * @return maskedMatriculaConsular + **/ + @javax.annotation.Nullable + public String getMaskedMatriculaConsular() { + return maskedMatriculaConsular; + } + + + public void setMaskedMatriculaConsular(String maskedMatriculaConsular) { + this.maskedMatriculaConsular = maskedMatriculaConsular; + } + + + public IndividualApplicationAllOfAttributes jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + public IndividualApplicationAllOfAttributes archived(Boolean archived) { + + this.archived = archived; + return this; + } + + /** + * Get archived + * @return archived + **/ + @javax.annotation.Nullable + public Boolean getArchived() { + return archived; + } + + + public void setArchived(Boolean archived) { + this.archived = archived; + } + + + public IndividualApplicationAllOfAttributes powerOfAttorneyAgent(PowerOfAttorneyAgent powerOfAttorneyAgent) { + + this.powerOfAttorneyAgent = powerOfAttorneyAgent; + return this; + } + + /** + * Get powerOfAttorneyAgent + * @return powerOfAttorneyAgent + **/ + @javax.annotation.Nullable + public PowerOfAttorneyAgent getPowerOfAttorneyAgent() { + return powerOfAttorneyAgent; + } + + + public void setPowerOfAttorneyAgent(PowerOfAttorneyAgent powerOfAttorneyAgent) { + this.powerOfAttorneyAgent = powerOfAttorneyAgent; + } + + + public IndividualApplicationAllOfAttributes industry(Industry industry) { + + this.industry = industry; + return this; + } + + /** + * Get industry + * @return industry + **/ + @javax.annotation.Nullable + public Industry getIndustry() { + return industry; + } + + + public void setIndustry(Industry industry) { + this.industry = industry; + } + + + public IndividualApplicationAllOfAttributes idTheftScore(Integer idTheftScore) { + + this.idTheftScore = idTheftScore; + return this; + } + + /** + * Get idTheftScore + * @return idTheftScore + **/ + @javax.annotation.Nullable + public Integer getIdTheftScore() { + return idTheftScore; + } + + + public void setIdTheftScore(Integer idTheftScore) { + this.idTheftScore = idTheftScore; + } + + + public IndividualApplicationAllOfAttributes occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public IndividualApplicationAllOfAttributes annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public IndividualApplicationAllOfAttributes sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + public IndividualApplicationAllOfAttributes annualRevenue(SoleProprietorshipAnnualRevenue annualRevenue) { + + this.annualRevenue = annualRevenue; + return this; + } + + /** + * Get annualRevenue + * @return annualRevenue + **/ + @javax.annotation.Nullable + public SoleProprietorshipAnnualRevenue getAnnualRevenue() { + return annualRevenue; + } + + + public void setAnnualRevenue(SoleProprietorshipAnnualRevenue annualRevenue) { + this.annualRevenue = annualRevenue; + } + + + public IndividualApplicationAllOfAttributes numberOfEmployees(SoleProprietorshipNumberOfEmployees numberOfEmployees) { + + this.numberOfEmployees = numberOfEmployees; + return this; + } + + /** + * Get numberOfEmployees + * @return numberOfEmployees + **/ + @javax.annotation.Nullable + public SoleProprietorshipNumberOfEmployees getNumberOfEmployees() { + return numberOfEmployees; + } + + + public void setNumberOfEmployees(SoleProprietorshipNumberOfEmployees numberOfEmployees) { + this.numberOfEmployees = numberOfEmployees; + } + + + public IndividualApplicationAllOfAttributes businessVertical(BusinessVertical businessVertical) { + + this.businessVertical = businessVertical; + return this; + } + + /** + * Get businessVertical + * @return businessVertical + **/ + @javax.annotation.Nullable + public BusinessVertical getBusinessVertical() { + return businessVertical; + } + + + public void setBusinessVertical(BusinessVertical businessVertical) { + this.businessVertical = businessVertical; + } + + + public IndividualApplicationAllOfAttributes website(String website) { + + this.website = website; + return this; + } + + /** + * Get website + * @return website + **/ + @javax.annotation.Nullable + public String getWebsite() { + return website; + } + + + public void setWebsite(String website) { + this.website = website; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualApplicationAllOfAttributes individualApplicationAllOfAttributes = (IndividualApplicationAllOfAttributes) o; + return Objects.equals(this.createdAt, individualApplicationAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, individualApplicationAllOfAttributes.updatedAt) && + Objects.equals(this.status, individualApplicationAllOfAttributes.status) && + Objects.equals(this.message, individualApplicationAllOfAttributes.message) && + Objects.equals(this.evaluationOutcome, individualApplicationAllOfAttributes.evaluationOutcome) && + Objects.equals(this.evaluationId, individualApplicationAllOfAttributes.evaluationId) && + Objects.equals(this.evaluationEntityId, individualApplicationAllOfAttributes.evaluationEntityId) && + Objects.equals(this.fullName, individualApplicationAllOfAttributes.fullName) && + Objects.equals(this.email, individualApplicationAllOfAttributes.email) && + Objects.equals(this.phone, individualApplicationAllOfAttributes.phone) && + Objects.equals(this.ssn, individualApplicationAllOfAttributes.ssn) && + Objects.equals(this.passport, individualApplicationAllOfAttributes.passport) && + Objects.equals(this.nationality, individualApplicationAllOfAttributes.nationality) && + Objects.equals(this.matriculaConsular, individualApplicationAllOfAttributes.matriculaConsular) && + Objects.equals(this.address, individualApplicationAllOfAttributes.address) && + Objects.equals(this.dateOfBirth, individualApplicationAllOfAttributes.dateOfBirth) && + Objects.equals(this.dba, individualApplicationAllOfAttributes.dba) && + Objects.equals(this.ein, individualApplicationAllOfAttributes.ein) && + Objects.equals(this.ip, individualApplicationAllOfAttributes.ip) && + Objects.equals(this.soleProprietorship, individualApplicationAllOfAttributes.soleProprietorship) && + Objects.equals(this.decisionMethod, individualApplicationAllOfAttributes.decisionMethod) && + Objects.equals(this.decisionUserId, individualApplicationAllOfAttributes.decisionUserId) && + Objects.equals(this.decisionReason, individualApplicationAllOfAttributes.decisionReason) && + Objects.equals(this.decisionDateTime, individualApplicationAllOfAttributes.decisionDateTime) && + Objects.equals(this.tags, individualApplicationAllOfAttributes.tags) && + Objects.equals(this.riskRate, individualApplicationAllOfAttributes.riskRate) && + Objects.equals(this.evaluationFlags, individualApplicationAllOfAttributes.evaluationFlags) && + Objects.equals(this.evaluationScores, individualApplicationAllOfAttributes.evaluationScores) && + Objects.equals(this.ipLocationDetails, individualApplicationAllOfAttributes.ipLocationDetails) && + Objects.equals(this.phoneLocationDetails, individualApplicationAllOfAttributes.phoneLocationDetails) && + Objects.equals(this.maskedSSN, individualApplicationAllOfAttributes.maskedSSN) && + Objects.equals(this.maskedPassport, individualApplicationAllOfAttributes.maskedPassport) && + Objects.equals(this.maskedMatriculaConsular, individualApplicationAllOfAttributes.maskedMatriculaConsular) && + Objects.equals(this.jwtSubject, individualApplicationAllOfAttributes.jwtSubject) && + Objects.equals(this.archived, individualApplicationAllOfAttributes.archived) && + Objects.equals(this.powerOfAttorneyAgent, individualApplicationAllOfAttributes.powerOfAttorneyAgent) && + Objects.equals(this.industry, individualApplicationAllOfAttributes.industry) && + Objects.equals(this.idTheftScore, individualApplicationAllOfAttributes.idTheftScore) && + Objects.equals(this.occupation, individualApplicationAllOfAttributes.occupation) && + Objects.equals(this.annualIncome, individualApplicationAllOfAttributes.annualIncome) && + Objects.equals(this.sourceOfIncome, individualApplicationAllOfAttributes.sourceOfIncome) && + Objects.equals(this.annualRevenue, individualApplicationAllOfAttributes.annualRevenue) && + Objects.equals(this.numberOfEmployees, individualApplicationAllOfAttributes.numberOfEmployees) && + Objects.equals(this.businessVertical, individualApplicationAllOfAttributes.businessVertical) && + Objects.equals(this.website, individualApplicationAllOfAttributes.website); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, status, message, evaluationOutcome, evaluationId, evaluationEntityId, fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, dba, ein, ip, soleProprietorship, decisionMethod, decisionUserId, decisionReason, decisionDateTime, tags, riskRate, evaluationFlags, evaluationScores, ipLocationDetails, phoneLocationDetails, maskedSSN, maskedPassport, maskedMatriculaConsular, jwtSubject, archived, powerOfAttorneyAgent, industry, idTheftScore, occupation, annualIncome, sourceOfIncome, annualRevenue, numberOfEmployees, businessVertical, website); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualApplicationAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" evaluationOutcome: ").append(toIndentedString(evaluationOutcome)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" evaluationEntityId: ").append(toIndentedString(evaluationEntityId)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" soleProprietorship: ").append(toIndentedString(soleProprietorship)).append("\n"); + sb.append(" decisionMethod: ").append(toIndentedString(decisionMethod)).append("\n"); + sb.append(" decisionUserId: ").append(toIndentedString(decisionUserId)).append("\n"); + sb.append(" decisionReason: ").append(toIndentedString(decisionReason)).append("\n"); + sb.append(" decisionDateTime: ").append(toIndentedString(decisionDateTime)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" riskRate: ").append(toIndentedString(riskRate)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" evaluationScores: ").append(toIndentedString(evaluationScores)).append("\n"); + sb.append(" ipLocationDetails: ").append(toIndentedString(ipLocationDetails)).append("\n"); + sb.append(" phoneLocationDetails: ").append(toIndentedString(phoneLocationDetails)).append("\n"); + sb.append(" maskedSSN: ").append(toIndentedString(maskedSSN)).append("\n"); + sb.append(" maskedPassport: ").append(toIndentedString(maskedPassport)).append("\n"); + sb.append(" maskedMatriculaConsular: ").append(toIndentedString(maskedMatriculaConsular)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); + sb.append(" powerOfAttorneyAgent: ").append(toIndentedString(powerOfAttorneyAgent)).append("\n"); + sb.append(" industry: ").append(toIndentedString(industry)).append("\n"); + sb.append(" idTheftScore: ").append(toIndentedString(idTheftScore)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append(" annualRevenue: ").append(toIndentedString(annualRevenue)).append("\n"); + sb.append(" numberOfEmployees: ").append(toIndentedString(numberOfEmployees)).append("\n"); + sb.append(" businessVertical: ").append(toIndentedString(businessVertical)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("status"); + openapiFields.add("message"); + openapiFields.add("evaluationOutcome"); + openapiFields.add("evaluationId"); + openapiFields.add("evaluationEntityId"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("ip"); + openapiFields.add("soleProprietorship"); + openapiFields.add("decisionMethod"); + openapiFields.add("decisionUserId"); + openapiFields.add("decisionReason"); + openapiFields.add("decisionDateTime"); + openapiFields.add("tags"); + openapiFields.add("riskRate"); + openapiFields.add("evaluationFlags"); + openapiFields.add("evaluationScores"); + openapiFields.add("ipLocationDetails"); + openapiFields.add("phoneLocationDetails"); + openapiFields.add("maskedSSN"); + openapiFields.add("maskedPassport"); + openapiFields.add("maskedMatriculaConsular"); + openapiFields.add("jwtSubject"); + openapiFields.add("archived"); + openapiFields.add("powerOfAttorneyAgent"); + openapiFields.add("industry"); + openapiFields.add("idTheftScore"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + openapiFields.add("annualRevenue"); + openapiFields.add("numberOfEmployees"); + openapiFields.add("businessVertical"); + openapiFields.add("website"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("fullName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualApplicationAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualApplicationAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualApplicationAllOfAttributes is not found in the empty JSON string", IndividualApplicationAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualApplicationAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualApplicationAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualApplicationAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("evaluationOutcome") != null && !jsonObj.get("evaluationOutcome").isJsonNull()) && !jsonObj.get("evaluationOutcome").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationOutcome` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationOutcome").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + if ((jsonObj.get("evaluationEntityId") != null && !jsonObj.get("evaluationEntityId").isJsonNull()) && !jsonObj.get("evaluationEntityId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationEntityId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationEntityId").toString())); + } + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("decisionMethod") != null && !jsonObj.get("decisionMethod").isJsonNull()) && !jsonObj.get("decisionMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionMethod").toString())); + } + if ((jsonObj.get("decisionUserId") != null && !jsonObj.get("decisionUserId").isJsonNull()) && !jsonObj.get("decisionUserId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionUserId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionUserId").toString())); + } + if ((jsonObj.get("decisionReason") != null && !jsonObj.get("decisionReason").isJsonNull()) && !jsonObj.get("decisionReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionReason").toString())); + } + if ((jsonObj.get("riskRate") != null && !jsonObj.get("riskRate").isJsonNull()) && !jsonObj.get("riskRate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `riskRate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskRate").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + if ((jsonObj.get("maskedSSN") != null && !jsonObj.get("maskedSSN").isJsonNull()) && !jsonObj.get("maskedSSN").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedSSN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedSSN").toString())); + } + if ((jsonObj.get("maskedPassport") != null && !jsonObj.get("maskedPassport").isJsonNull()) && !jsonObj.get("maskedPassport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedPassport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedPassport").toString())); + } + if ((jsonObj.get("maskedMatriculaConsular") != null && !jsonObj.get("maskedMatriculaConsular").isJsonNull()) && !jsonObj.get("maskedMatriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedMatriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedMatriculaConsular").toString())); + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + // validate the optional field `powerOfAttorneyAgent` + if (jsonObj.get("powerOfAttorneyAgent") != null && !jsonObj.get("powerOfAttorneyAgent").isJsonNull()) { + PowerOfAttorneyAgent.validateJsonElement(jsonObj.get("powerOfAttorneyAgent")); + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `website` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualApplicationAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualApplicationAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualApplicationAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualApplicationAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualApplicationAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualApplicationAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualApplicationAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to IndividualApplicationAllOfAttributes + */ + public static IndividualApplicationAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualApplicationAllOfAttributes.class); + } + + /** + * Convert an instance of IndividualApplicationAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualCustomer.java b/src/main/java/org/openapitools/client/model/IndividualCustomer.java new file mode 100644 index 00000000..2fd939b5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualCustomer.java @@ -0,0 +1,240 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Customer; +import org.openapitools.client.model.CustomerRelationships; +import org.openapitools.client.model.IndividualCustomerAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualCustomer extends Customer { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private IndividualCustomerAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CustomerRelationships relationships; + + public IndividualCustomer() { + this.type = this.getClass().getSimpleName(); + } + + public IndividualCustomer attributes(IndividualCustomerAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public IndividualCustomerAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(IndividualCustomerAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public IndividualCustomer relationships(CustomerRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CustomerRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CustomerRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualCustomer individualCustomer = (IndividualCustomer) o; + return Objects.equals(this.attributes, individualCustomer.attributes) && + Objects.equals(this.relationships, individualCustomer.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualCustomer {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualCustomer is not found in the empty JSON string", IndividualCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualCustomer + * @throws IOException if the JSON string is invalid with respect to IndividualCustomer + */ + public static IndividualCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualCustomer.class); + } + + /** + * Convert an instance of IndividualCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualCustomerAllOfAttributes.java b/src/main/java/org/openapitools/client/model/IndividualCustomerAllOfAttributes.java new file mode 100644 index 00000000..f1a282f8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualCustomerAllOfAttributes.java @@ -0,0 +1,1052 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AuthorizedUser; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualCustomerAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualCustomerAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_SOLE_PROPRIETORSHIP = "soleProprietorship"; + @SerializedName(SERIALIZED_NAME_SOLE_PROPRIETORSHIP) + private Boolean soleProprietorship = false; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets riskRate + */ + @JsonAdapter(RiskRateEnum.Adapter.class) + public enum RiskRateEnum { + LOW("low"), + + MEDIUM("medium"), + + HIGH("high"); + + private String value; + + RiskRateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RiskRateEnum fromValue(String value) { + for (RiskRateEnum b : RiskRateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RiskRateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RiskRateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RiskRateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RISK_RATE = "riskRate"; + @SerializedName(SERIALIZED_NAME_RISK_RATE) + private RiskRateEnum riskRate; + + public static final String SERIALIZED_NAME_MASKED_S_S_N = "maskedSSN"; + @SerializedName(SERIALIZED_NAME_MASKED_S_S_N) + private String maskedSSN; + + public static final String SERIALIZED_NAME_MASKED_PASSPORT = "maskedPassport"; + @SerializedName(SERIALIZED_NAME_MASKED_PASSPORT) + private String maskedPassport; + + public static final String SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR = "maskedMatriculaConsular"; + @SerializedName(SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR) + private String maskedMatriculaConsular; + + public static final String SERIALIZED_NAME_AUTHORIZED_USERS = "authorizedUsers"; + @SerializedName(SERIALIZED_NAME_AUTHORIZED_USERS) + private List authorizedUsers; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("Active"), + + ARCHIVED("Archived"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + /** + * Gets or Sets archiveReason + */ + @JsonAdapter(ArchiveReasonEnum.Adapter.class) + public enum ArchiveReasonEnum { + INACTIVE("Inactive"), + + FRAUDACHACTIVITY("FraudACHActivity"), + + FRAUDCARDACTIVITY("FraudCardActivity"), + + FRAUDCHECKACTIVITY("FraudCheckActivity"), + + FRAUDAPPLICATIONHISTORY("FraudApplicationHistory"), + + FRAUDACCOUNTACTIVITY("FraudAccountActivity"), + + FRAUDCLIENTIDENTIFIED("FraudClientIdentified"), + + FRAUDLINKEDTOFRAUDULENTCUSTOMER("FraudLinkedToFraudulentCustomer"); + + private String value; + + ArchiveReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ArchiveReasonEnum fromValue(String value) { + for (ArchiveReasonEnum b : ArchiveReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArchiveReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArchiveReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArchiveReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ARCHIVE_REASON = "archiveReason"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_REASON) + private ArchiveReasonEnum archiveReason; + + public IndividualCustomerAllOfAttributes() { + } + + public IndividualCustomerAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public IndividualCustomerAllOfAttributes fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public IndividualCustomerAllOfAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public IndividualCustomerAllOfAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public IndividualCustomerAllOfAttributes ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public IndividualCustomerAllOfAttributes passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public IndividualCustomerAllOfAttributes nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public IndividualCustomerAllOfAttributes matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public IndividualCustomerAllOfAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public IndividualCustomerAllOfAttributes dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public IndividualCustomerAllOfAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public IndividualCustomerAllOfAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public IndividualCustomerAllOfAttributes soleProprietorship(Boolean soleProprietorship) { + + this.soleProprietorship = soleProprietorship; + return this; + } + + /** + * Get soleProprietorship + * @return soleProprietorship + **/ + @javax.annotation.Nullable + public Boolean getSoleProprietorship() { + return soleProprietorship; + } + + + public void setSoleProprietorship(Boolean soleProprietorship) { + this.soleProprietorship = soleProprietorship; + } + + + public IndividualCustomerAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public IndividualCustomerAllOfAttributes riskRate(RiskRateEnum riskRate) { + + this.riskRate = riskRate; + return this; + } + + /** + * Get riskRate + * @return riskRate + **/ + @javax.annotation.Nullable + public RiskRateEnum getRiskRate() { + return riskRate; + } + + + public void setRiskRate(RiskRateEnum riskRate) { + this.riskRate = riskRate; + } + + + public IndividualCustomerAllOfAttributes maskedSSN(String maskedSSN) { + + this.maskedSSN = maskedSSN; + return this; + } + + /** + * Get maskedSSN + * @return maskedSSN + **/ + @javax.annotation.Nullable + public String getMaskedSSN() { + return maskedSSN; + } + + + public void setMaskedSSN(String maskedSSN) { + this.maskedSSN = maskedSSN; + } + + + public IndividualCustomerAllOfAttributes maskedPassport(String maskedPassport) { + + this.maskedPassport = maskedPassport; + return this; + } + + /** + * Get maskedPassport + * @return maskedPassport + **/ + @javax.annotation.Nullable + public String getMaskedPassport() { + return maskedPassport; + } + + + public void setMaskedPassport(String maskedPassport) { + this.maskedPassport = maskedPassport; + } + + + public IndividualCustomerAllOfAttributes maskedMatriculaConsular(String maskedMatriculaConsular) { + + this.maskedMatriculaConsular = maskedMatriculaConsular; + return this; + } + + /** + * Get maskedMatriculaConsular + * @return maskedMatriculaConsular + **/ + @javax.annotation.Nullable + public String getMaskedMatriculaConsular() { + return maskedMatriculaConsular; + } + + + public void setMaskedMatriculaConsular(String maskedMatriculaConsular) { + this.maskedMatriculaConsular = maskedMatriculaConsular; + } + + + public IndividualCustomerAllOfAttributes authorizedUsers(List authorizedUsers) { + + this.authorizedUsers = authorizedUsers; + return this; + } + + public IndividualCustomerAllOfAttributes addAuthorizedUsersItem(AuthorizedUser authorizedUsersItem) { + if (this.authorizedUsers == null) { + this.authorizedUsers = new ArrayList<>(); + } + this.authorizedUsers.add(authorizedUsersItem); + return this; + } + + /** + * Get authorizedUsers + * @return authorizedUsers + **/ + @javax.annotation.Nullable + public List getAuthorizedUsers() { + return authorizedUsers; + } + + + public void setAuthorizedUsers(List authorizedUsers) { + this.authorizedUsers = authorizedUsers; + } + + + public IndividualCustomerAllOfAttributes jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + public IndividualCustomerAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public IndividualCustomerAllOfAttributes archiveReason(ArchiveReasonEnum archiveReason) { + + this.archiveReason = archiveReason; + return this; + } + + /** + * Get archiveReason + * @return archiveReason + **/ + @javax.annotation.Nullable + public ArchiveReasonEnum getArchiveReason() { + return archiveReason; + } + + + public void setArchiveReason(ArchiveReasonEnum archiveReason) { + this.archiveReason = archiveReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualCustomerAllOfAttributes individualCustomerAllOfAttributes = (IndividualCustomerAllOfAttributes) o; + return Objects.equals(this.createdAt, individualCustomerAllOfAttributes.createdAt) && + Objects.equals(this.fullName, individualCustomerAllOfAttributes.fullName) && + Objects.equals(this.email, individualCustomerAllOfAttributes.email) && + Objects.equals(this.phone, individualCustomerAllOfAttributes.phone) && + Objects.equals(this.ssn, individualCustomerAllOfAttributes.ssn) && + Objects.equals(this.passport, individualCustomerAllOfAttributes.passport) && + Objects.equals(this.nationality, individualCustomerAllOfAttributes.nationality) && + Objects.equals(this.matriculaConsular, individualCustomerAllOfAttributes.matriculaConsular) && + Objects.equals(this.address, individualCustomerAllOfAttributes.address) && + Objects.equals(this.dateOfBirth, individualCustomerAllOfAttributes.dateOfBirth) && + Objects.equals(this.ein, individualCustomerAllOfAttributes.ein) && + Objects.equals(this.dba, individualCustomerAllOfAttributes.dba) && + Objects.equals(this.soleProprietorship, individualCustomerAllOfAttributes.soleProprietorship) && + Objects.equals(this.tags, individualCustomerAllOfAttributes.tags) && + Objects.equals(this.riskRate, individualCustomerAllOfAttributes.riskRate) && + Objects.equals(this.maskedSSN, individualCustomerAllOfAttributes.maskedSSN) && + Objects.equals(this.maskedPassport, individualCustomerAllOfAttributes.maskedPassport) && + Objects.equals(this.maskedMatriculaConsular, individualCustomerAllOfAttributes.maskedMatriculaConsular) && + Objects.equals(this.authorizedUsers, individualCustomerAllOfAttributes.authorizedUsers) && + Objects.equals(this.jwtSubject, individualCustomerAllOfAttributes.jwtSubject) && + Objects.equals(this.status, individualCustomerAllOfAttributes.status) && + Objects.equals(this.archiveReason, individualCustomerAllOfAttributes.archiveReason); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, ein, dba, soleProprietorship, tags, riskRate, maskedSSN, maskedPassport, maskedMatriculaConsular, authorizedUsers, jwtSubject, status, archiveReason); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualCustomerAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" soleProprietorship: ").append(toIndentedString(soleProprietorship)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" riskRate: ").append(toIndentedString(riskRate)).append("\n"); + sb.append(" maskedSSN: ").append(toIndentedString(maskedSSN)).append("\n"); + sb.append(" maskedPassport: ").append(toIndentedString(maskedPassport)).append("\n"); + sb.append(" maskedMatriculaConsular: ").append(toIndentedString(maskedMatriculaConsular)).append("\n"); + sb.append(" authorizedUsers: ").append(toIndentedString(authorizedUsers)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" archiveReason: ").append(toIndentedString(archiveReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("ein"); + openapiFields.add("dba"); + openapiFields.add("soleProprietorship"); + openapiFields.add("tags"); + openapiFields.add("riskRate"); + openapiFields.add("maskedSSN"); + openapiFields.add("maskedPassport"); + openapiFields.add("maskedMatriculaConsular"); + openapiFields.add("authorizedUsers"); + openapiFields.add("jwtSubject"); + openapiFields.add("status"); + openapiFields.add("archiveReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualCustomerAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualCustomerAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualCustomerAllOfAttributes is not found in the empty JSON string", IndividualCustomerAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualCustomerAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualCustomerAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualCustomerAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("riskRate") != null && !jsonObj.get("riskRate").isJsonNull()) && !jsonObj.get("riskRate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `riskRate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskRate").toString())); + } + if ((jsonObj.get("maskedSSN") != null && !jsonObj.get("maskedSSN").isJsonNull()) && !jsonObj.get("maskedSSN").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedSSN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedSSN").toString())); + } + if ((jsonObj.get("maskedPassport") != null && !jsonObj.get("maskedPassport").isJsonNull()) && !jsonObj.get("maskedPassport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedPassport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedPassport").toString())); + } + if ((jsonObj.get("maskedMatriculaConsular") != null && !jsonObj.get("maskedMatriculaConsular").isJsonNull()) && !jsonObj.get("maskedMatriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedMatriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedMatriculaConsular").toString())); + } + if (jsonObj.get("authorizedUsers") != null && !jsonObj.get("authorizedUsers").isJsonNull()) { + JsonArray jsonArrayauthorizedUsers = jsonObj.getAsJsonArray("authorizedUsers"); + if (jsonArrayauthorizedUsers != null) { + // ensure the json data is an array + if (!jsonObj.get("authorizedUsers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `authorizedUsers` to be an array in the JSON string but got `%s`", jsonObj.get("authorizedUsers").toString())); + } + + // validate the optional field `authorizedUsers` (array) + for (int i = 0; i < jsonArrayauthorizedUsers.size(); i++) { + AuthorizedUser.validateJsonElement(jsonArrayauthorizedUsers.get(i)); + }; + } + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("archiveReason") != null && !jsonObj.get("archiveReason").isJsonNull()) && !jsonObj.get("archiveReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `archiveReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archiveReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualCustomerAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualCustomerAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualCustomerAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualCustomerAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualCustomerAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualCustomerAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualCustomerAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to IndividualCustomerAllOfAttributes + */ + public static IndividualCustomerAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualCustomerAllOfAttributes.class); + } + + /** + * Convert an instance of IndividualCustomerAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualDebitCard.java b/src/main/java/org/openapitools/client/model/IndividualDebitCard.java new file mode 100644 index 00000000..1fe659be --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualDebitCard.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.CardRelationships; +import org.openapitools.client.model.IndividualDebitCardAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualDebitCard extends Card { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private IndividualDebitCardAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CardRelationships relationships; + + public IndividualDebitCard() { + this.type = this.getClass().getSimpleName(); + } + + public IndividualDebitCard attributes(IndividualDebitCardAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public IndividualDebitCardAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(IndividualDebitCardAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public IndividualDebitCard relationships(CardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualDebitCard individualDebitCard = (IndividualDebitCard) o; + return Objects.equals(this.attributes, individualDebitCard.attributes) && + Objects.equals(this.relationships, individualDebitCard.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualDebitCard {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualDebitCard is not found in the empty JSON string", IndividualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualDebitCard + * @throws IOException if the JSON string is invalid with respect to IndividualDebitCard + */ + public static IndividualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualDebitCard.class); + } + + /** + * Convert an instance of IndividualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualDebitCardAllOfAttributes.java b/src/main/java/org/openapitools/client/model/IndividualDebitCardAllOfAttributes.java new file mode 100644 index 00000000..bf69c5e3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualDebitCardAllOfAttributes.java @@ -0,0 +1,490 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.PhysicalCardStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualDebitCardAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualDebitCardAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_LAST4_DIGITS = "last4Digits"; + @SerializedName(SERIALIZED_NAME_LAST4_DIGITS) + private String last4Digits; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expirationDate"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private String expirationDate; + + public static final String SERIALIZED_NAME_SHIPPING_ADDRESS = "shippingAddress"; + @SerializedName(SERIALIZED_NAME_SHIPPING_ADDRESS) + private Address shippingAddress; + + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private String bin; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private PhysicalCardStatus status; + + public static final String SERIALIZED_NAME_DESIGN = "design"; + @SerializedName(SERIALIZED_NAME_DESIGN) + private String design; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_FREEZE_REASON = "freezeReason"; + @SerializedName(SERIALIZED_NAME_FREEZE_REASON) + private String freezeReason; + + public IndividualDebitCardAllOfAttributes() { + } + + public IndividualDebitCardAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public IndividualDebitCardAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public IndividualDebitCardAllOfAttributes last4Digits(String last4Digits) { + + this.last4Digits = last4Digits; + return this; + } + + /** + * Get last4Digits + * @return last4Digits + **/ + @javax.annotation.Nonnull + public String getLast4Digits() { + return last4Digits; + } + + + public void setLast4Digits(String last4Digits) { + this.last4Digits = last4Digits; + } + + + public IndividualDebitCardAllOfAttributes expirationDate(String expirationDate) { + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nonnull + public String getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(String expirationDate) { + this.expirationDate = expirationDate; + } + + + public IndividualDebitCardAllOfAttributes shippingAddress(Address shippingAddress) { + + this.shippingAddress = shippingAddress; + return this; + } + + /** + * Get shippingAddress + * @return shippingAddress + **/ + @javax.annotation.Nullable + public Address getShippingAddress() { + return shippingAddress; + } + + + public void setShippingAddress(Address shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public IndividualDebitCardAllOfAttributes bin(String bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nullable + public String getBin() { + return bin; + } + + + public void setBin(String bin) { + this.bin = bin; + } + + + public IndividualDebitCardAllOfAttributes status(PhysicalCardStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public PhysicalCardStatus getStatus() { + return status; + } + + + public void setStatus(PhysicalCardStatus status) { + this.status = status; + } + + + public IndividualDebitCardAllOfAttributes design(String design) { + + this.design = design; + return this; + } + + /** + * Get design + * @return design + **/ + @javax.annotation.Nullable + public String getDesign() { + return design; + } + + + public void setDesign(String design) { + this.design = design; + } + + + public IndividualDebitCardAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public IndividualDebitCardAllOfAttributes freezeReason(String freezeReason) { + + this.freezeReason = freezeReason; + return this; + } + + /** + * Get freezeReason + * @return freezeReason + **/ + @javax.annotation.Nullable + public String getFreezeReason() { + return freezeReason; + } + + + public void setFreezeReason(String freezeReason) { + this.freezeReason = freezeReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualDebitCardAllOfAttributes individualDebitCardAllOfAttributes = (IndividualDebitCardAllOfAttributes) o; + return Objects.equals(this.createdAt, individualDebitCardAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, individualDebitCardAllOfAttributes.updatedAt) && + Objects.equals(this.last4Digits, individualDebitCardAllOfAttributes.last4Digits) && + Objects.equals(this.expirationDate, individualDebitCardAllOfAttributes.expirationDate) && + Objects.equals(this.shippingAddress, individualDebitCardAllOfAttributes.shippingAddress) && + Objects.equals(this.bin, individualDebitCardAllOfAttributes.bin) && + Objects.equals(this.status, individualDebitCardAllOfAttributes.status) && + Objects.equals(this.design, individualDebitCardAllOfAttributes.design) && + Objects.equals(this.tags, individualDebitCardAllOfAttributes.tags) && + Objects.equals(this.freezeReason, individualDebitCardAllOfAttributes.freezeReason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, last4Digits, expirationDate, shippingAddress, bin, status, design, tags, freezeReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualDebitCardAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" last4Digits: ").append(toIndentedString(last4Digits)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" design: ").append(toIndentedString(design)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" freezeReason: ").append(toIndentedString(freezeReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("last4Digits"); + openapiFields.add("expirationDate"); + openapiFields.add("shippingAddress"); + openapiFields.add("bin"); + openapiFields.add("status"); + openapiFields.add("design"); + openapiFields.add("tags"); + openapiFields.add("freezeReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("last4Digits"); + openapiRequiredFields.add("expirationDate"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualDebitCardAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualDebitCardAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualDebitCardAllOfAttributes is not found in the empty JSON string", IndividualDebitCardAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualDebitCardAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualDebitCardAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualDebitCardAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("last4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last4Digits").toString())); + } + if (!jsonObj.get("expirationDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expirationDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expirationDate").toString())); + } + // validate the optional field `shippingAddress` + if (jsonObj.get("shippingAddress") != null && !jsonObj.get("shippingAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("shippingAddress")); + } + if ((jsonObj.get("bin") != null && !jsonObj.get("bin").isJsonNull()) && !jsonObj.get("bin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bin").toString())); + } + if ((jsonObj.get("design") != null && !jsonObj.get("design").isJsonNull()) && !jsonObj.get("design").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `design` to be a primitive type in the JSON string but got `%s`", jsonObj.get("design").toString())); + } + if ((jsonObj.get("freezeReason") != null && !jsonObj.get("freezeReason").isJsonNull()) && !jsonObj.get("freezeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `freezeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("freezeReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualDebitCardAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualDebitCardAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualDebitCardAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualDebitCardAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualDebitCardAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualDebitCardAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualDebitCardAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to IndividualDebitCardAllOfAttributes + */ + public static IndividualDebitCardAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualDebitCardAllOfAttributes.class); + } + + /** + * Convert an instance of IndividualDebitCardAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualVirtualDebitCard.java b/src/main/java/org/openapitools/client/model/IndividualVirtualDebitCard.java new file mode 100644 index 00000000..0ee7eae5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualVirtualDebitCard.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.CardRelationships; +import org.openapitools.client.model.IndividualVirtualDebitCardAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualVirtualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualVirtualDebitCard extends Card { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private IndividualVirtualDebitCardAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CardRelationships relationships; + + public IndividualVirtualDebitCard() { + this.type = this.getClass().getSimpleName(); + } + + public IndividualVirtualDebitCard attributes(IndividualVirtualDebitCardAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public IndividualVirtualDebitCardAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(IndividualVirtualDebitCardAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public IndividualVirtualDebitCard relationships(CardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public CardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualVirtualDebitCard individualVirtualDebitCard = (IndividualVirtualDebitCard) o; + return Objects.equals(this.attributes, individualVirtualDebitCard.attributes) && + Objects.equals(this.relationships, individualVirtualDebitCard.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualVirtualDebitCard {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualVirtualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualVirtualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualVirtualDebitCard is not found in the empty JSON string", IndividualVirtualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualVirtualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualVirtualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualVirtualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualVirtualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualVirtualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualVirtualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualVirtualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualVirtualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualVirtualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualVirtualDebitCard + * @throws IOException if the JSON string is invalid with respect to IndividualVirtualDebitCard + */ + public static IndividualVirtualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualVirtualDebitCard.class); + } + + /** + * Convert an instance of IndividualVirtualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/IndividualVirtualDebitCardAllOfAttributes.java b/src/main/java/org/openapitools/client/model/IndividualVirtualDebitCardAllOfAttributes.java new file mode 100644 index 00000000..cca4851e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/IndividualVirtualDebitCardAllOfAttributes.java @@ -0,0 +1,426 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.VirtualCardStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IndividualVirtualDebitCardAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class IndividualVirtualDebitCardAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_LAST4_DIGITS = "last4Digits"; + @SerializedName(SERIALIZED_NAME_LAST4_DIGITS) + private String last4Digits; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expirationDate"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private String expirationDate; + + public static final String SERIALIZED_NAME_BIN = "bin"; + @SerializedName(SERIALIZED_NAME_BIN) + private String bin; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private VirtualCardStatus status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_FREEZE_REASON = "freezeReason"; + @SerializedName(SERIALIZED_NAME_FREEZE_REASON) + private String freezeReason; + + public IndividualVirtualDebitCardAllOfAttributes() { + } + + public IndividualVirtualDebitCardAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public IndividualVirtualDebitCardAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public IndividualVirtualDebitCardAllOfAttributes last4Digits(String last4Digits) { + + this.last4Digits = last4Digits; + return this; + } + + /** + * Get last4Digits + * @return last4Digits + **/ + @javax.annotation.Nonnull + public String getLast4Digits() { + return last4Digits; + } + + + public void setLast4Digits(String last4Digits) { + this.last4Digits = last4Digits; + } + + + public IndividualVirtualDebitCardAllOfAttributes expirationDate(String expirationDate) { + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nonnull + public String getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(String expirationDate) { + this.expirationDate = expirationDate; + } + + + public IndividualVirtualDebitCardAllOfAttributes bin(String bin) { + + this.bin = bin; + return this; + } + + /** + * Get bin + * @return bin + **/ + @javax.annotation.Nullable + public String getBin() { + return bin; + } + + + public void setBin(String bin) { + this.bin = bin; + } + + + public IndividualVirtualDebitCardAllOfAttributes status(VirtualCardStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public VirtualCardStatus getStatus() { + return status; + } + + + public void setStatus(VirtualCardStatus status) { + this.status = status; + } + + + public IndividualVirtualDebitCardAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public IndividualVirtualDebitCardAllOfAttributes freezeReason(String freezeReason) { + + this.freezeReason = freezeReason; + return this; + } + + /** + * Get freezeReason + * @return freezeReason + **/ + @javax.annotation.Nullable + public String getFreezeReason() { + return freezeReason; + } + + + public void setFreezeReason(String freezeReason) { + this.freezeReason = freezeReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndividualVirtualDebitCardAllOfAttributes individualVirtualDebitCardAllOfAttributes = (IndividualVirtualDebitCardAllOfAttributes) o; + return Objects.equals(this.createdAt, individualVirtualDebitCardAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, individualVirtualDebitCardAllOfAttributes.updatedAt) && + Objects.equals(this.last4Digits, individualVirtualDebitCardAllOfAttributes.last4Digits) && + Objects.equals(this.expirationDate, individualVirtualDebitCardAllOfAttributes.expirationDate) && + Objects.equals(this.bin, individualVirtualDebitCardAllOfAttributes.bin) && + Objects.equals(this.status, individualVirtualDebitCardAllOfAttributes.status) && + Objects.equals(this.tags, individualVirtualDebitCardAllOfAttributes.tags) && + Objects.equals(this.freezeReason, individualVirtualDebitCardAllOfAttributes.freezeReason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, last4Digits, expirationDate, bin, status, tags, freezeReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndividualVirtualDebitCardAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" last4Digits: ").append(toIndentedString(last4Digits)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" bin: ").append(toIndentedString(bin)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" freezeReason: ").append(toIndentedString(freezeReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("last4Digits"); + openapiFields.add("expirationDate"); + openapiFields.add("bin"); + openapiFields.add("status"); + openapiFields.add("tags"); + openapiFields.add("freezeReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("last4Digits"); + openapiRequiredFields.add("expirationDate"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IndividualVirtualDebitCardAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IndividualVirtualDebitCardAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndividualVirtualDebitCardAllOfAttributes is not found in the empty JSON string", IndividualVirtualDebitCardAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IndividualVirtualDebitCardAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndividualVirtualDebitCardAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IndividualVirtualDebitCardAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("last4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last4Digits").toString())); + } + if (!jsonObj.get("expirationDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expirationDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expirationDate").toString())); + } + if ((jsonObj.get("bin") != null && !jsonObj.get("bin").isJsonNull()) && !jsonObj.get("bin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `bin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bin").toString())); + } + if ((jsonObj.get("freezeReason") != null && !jsonObj.get("freezeReason").isJsonNull()) && !jsonObj.get("freezeReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `freezeReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("freezeReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IndividualVirtualDebitCardAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndividualVirtualDebitCardAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndividualVirtualDebitCardAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IndividualVirtualDebitCardAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IndividualVirtualDebitCardAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IndividualVirtualDebitCardAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of IndividualVirtualDebitCardAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to IndividualVirtualDebitCardAllOfAttributes + */ + public static IndividualVirtualDebitCardAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndividualVirtualDebitCardAllOfAttributes.class); + } + + /** + * Convert an instance of IndividualVirtualDebitCardAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Industry.java b/src/main/java/org/openapitools/client/model/Industry.java new file mode 100644 index 00000000..1b819a1b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Industry.java @@ -0,0 +1,92 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets industry + */ +@JsonAdapter(Industry.Adapter.class) +public enum Industry { + + RETAIL("Retail"), + + WHOLESALE("Wholesale"), + + RESTAURANTS("Restaurants"), + + HOSPITALS("Hospitals"), + + CONSTRUCTION("Construction"), + + INSURANCE("Insurance"), + + UNIONS("Unions"), + + REALESTATE("RealEstate"), + + FREELANCEPROFESSIONAL("FreelanceProfessional"), + + OTHERPROFESSIONALSERVICES("OtherProfessionalServices"), + + ONLINERETAILER("OnlineRetailer"), + + OTHEREDUCATIONSERVICES("OtherEducationServices"); + + private String value; + + Industry(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Industry fromValue(String value) { + for (Industry b : Industry.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final Industry enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public Industry read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return Industry.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/Institution.java b/src/main/java/org/openapitools/client/model/Institution.java new file mode 100644 index 00000000..a8673f44 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Institution.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.InstitutionAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Institution + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Institution { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "institution"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private InstitutionAttributes attributes; + + public Institution() { + } + + public Institution type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Institution attributes(InstitutionAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public InstitutionAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(InstitutionAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Institution institution = (Institution) o; + return Objects.equals(this.type, institution.type) && + Objects.equals(this.attributes, institution.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Institution {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Institution + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Institution.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Institution is not found in the empty JSON string", Institution.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Institution.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Institution` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Institution.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + InstitutionAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Institution.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Institution' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Institution.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Institution value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Institution read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Institution given an JSON string + * + * @param jsonString JSON string + * @return An instance of Institution + * @throws IOException if the JSON string is invalid with respect to Institution + */ + public static Institution fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Institution.class); + } + + /** + * Convert an instance of Institution to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/InstitutionAttributes.java b/src/main/java/org/openapitools/client/model/InstitutionAttributes.java new file mode 100644 index 00000000..ccdd7428 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/InstitutionAttributes.java @@ -0,0 +1,337 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * InstitutionAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InstitutionAttributes { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private String address; + + public static final String SERIALIZED_NAME_IS_WIRE_SUPPORTED = "isWireSupported"; + @SerializedName(SERIALIZED_NAME_IS_WIRE_SUPPORTED) + private Boolean isWireSupported; + + public static final String SERIALIZED_NAME_IS_A_C_H_SUPPORTED = "isACHSupported"; + @SerializedName(SERIALIZED_NAME_IS_A_C_H_SUPPORTED) + private Boolean isACHSupported; + + public InstitutionAttributes() { + } + + public InstitutionAttributes routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public InstitutionAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public InstitutionAttributes address(String address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public String getAddress() { + return address; + } + + + public void setAddress(String address) { + this.address = address; + } + + + public InstitutionAttributes isWireSupported(Boolean isWireSupported) { + + this.isWireSupported = isWireSupported; + return this; + } + + /** + * Get isWireSupported + * @return isWireSupported + **/ + @javax.annotation.Nonnull + public Boolean getIsWireSupported() { + return isWireSupported; + } + + + public void setIsWireSupported(Boolean isWireSupported) { + this.isWireSupported = isWireSupported; + } + + + public InstitutionAttributes isACHSupported(Boolean isACHSupported) { + + this.isACHSupported = isACHSupported; + return this; + } + + /** + * Get isACHSupported + * @return isACHSupported + **/ + @javax.annotation.Nonnull + public Boolean getIsACHSupported() { + return isACHSupported; + } + + + public void setIsACHSupported(Boolean isACHSupported) { + this.isACHSupported = isACHSupported; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InstitutionAttributes institutionAttributes = (InstitutionAttributes) o; + return Objects.equals(this.routingNumber, institutionAttributes.routingNumber) && + Objects.equals(this.name, institutionAttributes.name) && + Objects.equals(this.address, institutionAttributes.address) && + Objects.equals(this.isWireSupported, institutionAttributes.isWireSupported) && + Objects.equals(this.isACHSupported, institutionAttributes.isACHSupported); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, name, address, isWireSupported, isACHSupported); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InstitutionAttributes {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" isWireSupported: ").append(toIndentedString(isWireSupported)).append("\n"); + sb.append(" isACHSupported: ").append(toIndentedString(isACHSupported)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("name"); + openapiFields.add("address"); + openapiFields.add("isWireSupported"); + openapiFields.add("isACHSupported"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("isWireSupported"); + openapiRequiredFields.add("isACHSupported"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InstitutionAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InstitutionAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InstitutionAttributes is not found in the empty JSON string", InstitutionAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InstitutionAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InstitutionAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InstitutionAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InstitutionAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InstitutionAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InstitutionAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InstitutionAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InstitutionAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InstitutionAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of InstitutionAttributes + * @throws IOException if the JSON string is invalid with respect to InstitutionAttributes + */ + public static InstitutionAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InstitutionAttributes.class); + } + + /** + * Convert an instance of InstitutionAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/InterchangeTransaction.java b/src/main/java/org/openapitools/client/model/InterchangeTransaction.java new file mode 100644 index 00000000..29f7139a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/InterchangeTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * InterchangeTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InterchangeTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public InterchangeTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public InterchangeTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public InterchangeTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InterchangeTransaction interchangeTransaction = (InterchangeTransaction) o; + return Objects.equals(this.attributes, interchangeTransaction.attributes) && + Objects.equals(this.relationships, interchangeTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InterchangeTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InterchangeTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InterchangeTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InterchangeTransaction is not found in the empty JSON string", InterchangeTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InterchangeTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InterchangeTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InterchangeTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InterchangeTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InterchangeTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InterchangeTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InterchangeTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InterchangeTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InterchangeTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of InterchangeTransaction + * @throws IOException if the JSON string is invalid with respect to InterchangeTransaction + */ + public static InterchangeTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InterchangeTransaction.class); + } + + /** + * Convert an instance of InterchangeTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/InterestShareTransaction.java b/src/main/java/org/openapitools/client/model/InterestShareTransaction.java new file mode 100644 index 00000000..c05832e9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/InterestShareTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * InterestShareTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InterestShareTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public InterestShareTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public InterestShareTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public InterestShareTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InterestShareTransaction interestShareTransaction = (InterestShareTransaction) o; + return Objects.equals(this.attributes, interestShareTransaction.attributes) && + Objects.equals(this.relationships, interestShareTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InterestShareTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InterestShareTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InterestShareTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InterestShareTransaction is not found in the empty JSON string", InterestShareTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InterestShareTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InterestShareTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InterestShareTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InterestShareTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InterestShareTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InterestShareTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InterestShareTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InterestShareTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InterestShareTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of InterestShareTransaction + * @throws IOException if the JSON string is invalid with respect to InterestShareTransaction + */ + public static InterestShareTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InterestShareTransaction.class); + } + + /** + * Convert an instance of InterestShareTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/InterestTransaction.java b/src/main/java/org/openapitools/client/model/InterestTransaction.java new file mode 100644 index 00000000..5f512751 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/InterestTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * InterestTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InterestTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public InterestTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public InterestTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public InterestTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InterestTransaction interestTransaction = (InterestTransaction) o; + return Objects.equals(this.attributes, interestTransaction.attributes) && + Objects.equals(this.relationships, interestTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InterestTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InterestTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InterestTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InterestTransaction is not found in the empty JSON string", InterestTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InterestTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InterestTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InterestTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InterestTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InterestTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InterestTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InterestTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InterestTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InterestTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of InterestTransaction + * @throws IOException if the JSON string is invalid with respect to InterestTransaction + */ + public static InterestTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InterestTransaction.class); + } + + /** + * Convert an instance of InterestTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Limits.java b/src/main/java/org/openapitools/client/model/Limits.java new file mode 100644 index 00000000..a1546e8b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Limits.java @@ -0,0 +1,272 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.LimitsAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Limits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Limits { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private LimitsAttributes attributes; + + public Limits() { + } + + public Limits type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Limits id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Limits attributes(LimitsAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public LimitsAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(LimitsAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Limits limits = (Limits) o; + return Objects.equals(this.type, limits.type) && + Objects.equals(this.id, limits.id) && + Objects.equals(this.attributes, limits.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Limits {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Limits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Limits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Limits is not found in the empty JSON string", Limits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Limits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Limits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + LimitsAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Limits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Limits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Limits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Limits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Limits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Limits given an JSON string + * + * @param jsonString JSON string + * @return An instance of Limits + * @throws IOException if the JSON string is invalid with respect to Limits + */ + public static Limits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Limits.class); + } + + /** + * Convert an instance of Limits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Limits1.java b/src/main/java/org/openapitools/client/model/Limits1.java new file mode 100644 index 00000000..966d6fa6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Limits1.java @@ -0,0 +1,181 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Limits1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Limits1 { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public Limits1() { + this.type = this.getClass().getSimpleName(); + } + + public Limits1 type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Limits1 limits1 = (Limits1) o; + return Objects.equals(this.type, limits1.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Limits1 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Limits1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Limits1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Limits1 is not found in the empty JSON string", Limits1.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "creditLimits": + CreditLimits.validateJsonElement(jsonElement); + break; + case "limits": + DepositLimits.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Limits1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Limits1 + * @throws IOException if the JSON string is invalid with respect to Limits1 + */ + public static Limits1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Limits1.class); + } + + /** + * Convert an instance of Limits1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/LimitsAttributes.java b/src/main/java/org/openapitools/client/model/LimitsAttributes.java new file mode 100644 index 00000000..c6495f9a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/LimitsAttributes.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.LimitsAttributesCard; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * LimitsAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class LimitsAttributes { + public static final String SERIALIZED_NAME_CARD = "card"; + @SerializedName(SERIALIZED_NAME_CARD) + private LimitsAttributesCard card; + + public LimitsAttributes() { + } + + public LimitsAttributes card(LimitsAttributesCard card) { + + this.card = card; + return this; + } + + /** + * Get card + * @return card + **/ + @javax.annotation.Nullable + public LimitsAttributesCard getCard() { + return card; + } + + + public void setCard(LimitsAttributesCard card) { + this.card = card; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LimitsAttributes limitsAttributes = (LimitsAttributes) o; + return Objects.equals(this.card, limitsAttributes.card); + } + + @Override + public int hashCode() { + return Objects.hash(card); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LimitsAttributes {\n"); + sb.append(" card: ").append(toIndentedString(card)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("card"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LimitsAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LimitsAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LimitsAttributes is not found in the empty JSON string", LimitsAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LimitsAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LimitsAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `card` + if (jsonObj.get("card") != null && !jsonObj.get("card").isJsonNull()) { + LimitsAttributesCard.validateJsonElement(jsonObj.get("card")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LimitsAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LimitsAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LimitsAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LimitsAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LimitsAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LimitsAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of LimitsAttributes + * @throws IOException if the JSON string is invalid with respect to LimitsAttributes + */ + public static LimitsAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LimitsAttributes.class); + } + + /** + * Convert an instance of LimitsAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/LimitsAttributesCard.java b/src/main/java/org/openapitools/client/model/LimitsAttributesCard.java new file mode 100644 index 00000000..5346753d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/LimitsAttributesCard.java @@ -0,0 +1,243 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.LimitsAttributesCardLimits; +import org.openapitools.client.model.LimitsAttributesCardTotalsDaily; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * LimitsAttributesCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class LimitsAttributesCard { + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private LimitsAttributesCardLimits limits; + + public static final String SERIALIZED_NAME_TOTALS_DAILY = "totalsDaily"; + @SerializedName(SERIALIZED_NAME_TOTALS_DAILY) + private LimitsAttributesCardTotalsDaily totalsDaily; + + public LimitsAttributesCard() { + } + + public LimitsAttributesCard limits(LimitsAttributesCardLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public LimitsAttributesCardLimits getLimits() { + return limits; + } + + + public void setLimits(LimitsAttributesCardLimits limits) { + this.limits = limits; + } + + + public LimitsAttributesCard totalsDaily(LimitsAttributesCardTotalsDaily totalsDaily) { + + this.totalsDaily = totalsDaily; + return this; + } + + /** + * Get totalsDaily + * @return totalsDaily + **/ + @javax.annotation.Nullable + public LimitsAttributesCardTotalsDaily getTotalsDaily() { + return totalsDaily; + } + + + public void setTotalsDaily(LimitsAttributesCardTotalsDaily totalsDaily) { + this.totalsDaily = totalsDaily; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LimitsAttributesCard limitsAttributesCard = (LimitsAttributesCard) o; + return Objects.equals(this.limits, limitsAttributesCard.limits) && + Objects.equals(this.totalsDaily, limitsAttributesCard.totalsDaily); + } + + @Override + public int hashCode() { + return Objects.hash(limits, totalsDaily); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LimitsAttributesCard {\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" totalsDaily: ").append(toIndentedString(totalsDaily)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limits"); + openapiFields.add("totalsDaily"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LimitsAttributesCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LimitsAttributesCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LimitsAttributesCard is not found in the empty JSON string", LimitsAttributesCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LimitsAttributesCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LimitsAttributesCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + LimitsAttributesCardLimits.validateJsonElement(jsonObj.get("limits")); + } + // validate the optional field `totalsDaily` + if (jsonObj.get("totalsDaily") != null && !jsonObj.get("totalsDaily").isJsonNull()) { + LimitsAttributesCardTotalsDaily.validateJsonElement(jsonObj.get("totalsDaily")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LimitsAttributesCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LimitsAttributesCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LimitsAttributesCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LimitsAttributesCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LimitsAttributesCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LimitsAttributesCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of LimitsAttributesCard + * @throws IOException if the JSON string is invalid with respect to LimitsAttributesCard + */ + public static LimitsAttributesCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LimitsAttributesCard.class); + } + + /** + * Convert an instance of LimitsAttributesCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/LimitsAttributesCardLimits.java b/src/main/java/org/openapitools/client/model/LimitsAttributesCardLimits.java new file mode 100644 index 00000000..403c1f95 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/LimitsAttributesCardLimits.java @@ -0,0 +1,290 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * LimitsAttributesCardLimits + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class LimitsAttributesCardLimits { + public static final String SERIALIZED_NAME_DAILY_WITHDRAWAL = "dailyWithdrawal"; + @SerializedName(SERIALIZED_NAME_DAILY_WITHDRAWAL) + private BigDecimal dailyWithdrawal; + + public static final String SERIALIZED_NAME_DAILY_DEPOSIT = "dailyDeposit"; + @SerializedName(SERIALIZED_NAME_DAILY_DEPOSIT) + private BigDecimal dailyDeposit; + + public static final String SERIALIZED_NAME_DAILY_PURCHASE = "dailyPurchase"; + @SerializedName(SERIALIZED_NAME_DAILY_PURCHASE) + private BigDecimal dailyPurchase; + + public static final String SERIALIZED_NAME_DAILY_CARD_TRANSACTION = "dailyCardTransaction"; + @SerializedName(SERIALIZED_NAME_DAILY_CARD_TRANSACTION) + private BigDecimal dailyCardTransaction; + + public LimitsAttributesCardLimits() { + } + + public LimitsAttributesCardLimits dailyWithdrawal(BigDecimal dailyWithdrawal) { + + this.dailyWithdrawal = dailyWithdrawal; + return this; + } + + /** + * Get dailyWithdrawal + * @return dailyWithdrawal + **/ + @javax.annotation.Nullable + public BigDecimal getDailyWithdrawal() { + return dailyWithdrawal; + } + + + public void setDailyWithdrawal(BigDecimal dailyWithdrawal) { + this.dailyWithdrawal = dailyWithdrawal; + } + + + public LimitsAttributesCardLimits dailyDeposit(BigDecimal dailyDeposit) { + + this.dailyDeposit = dailyDeposit; + return this; + } + + /** + * Get dailyDeposit + * @return dailyDeposit + **/ + @javax.annotation.Nullable + public BigDecimal getDailyDeposit() { + return dailyDeposit; + } + + + public void setDailyDeposit(BigDecimal dailyDeposit) { + this.dailyDeposit = dailyDeposit; + } + + + public LimitsAttributesCardLimits dailyPurchase(BigDecimal dailyPurchase) { + + this.dailyPurchase = dailyPurchase; + return this; + } + + /** + * Get dailyPurchase + * @return dailyPurchase + **/ + @javax.annotation.Nullable + public BigDecimal getDailyPurchase() { + return dailyPurchase; + } + + + public void setDailyPurchase(BigDecimal dailyPurchase) { + this.dailyPurchase = dailyPurchase; + } + + + public LimitsAttributesCardLimits dailyCardTransaction(BigDecimal dailyCardTransaction) { + + this.dailyCardTransaction = dailyCardTransaction; + return this; + } + + /** + * Get dailyCardTransaction + * @return dailyCardTransaction + **/ + @javax.annotation.Nullable + public BigDecimal getDailyCardTransaction() { + return dailyCardTransaction; + } + + + public void setDailyCardTransaction(BigDecimal dailyCardTransaction) { + this.dailyCardTransaction = dailyCardTransaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LimitsAttributesCardLimits limitsAttributesCardLimits = (LimitsAttributesCardLimits) o; + return Objects.equals(this.dailyWithdrawal, limitsAttributesCardLimits.dailyWithdrawal) && + Objects.equals(this.dailyDeposit, limitsAttributesCardLimits.dailyDeposit) && + Objects.equals(this.dailyPurchase, limitsAttributesCardLimits.dailyPurchase) && + Objects.equals(this.dailyCardTransaction, limitsAttributesCardLimits.dailyCardTransaction); + } + + @Override + public int hashCode() { + return Objects.hash(dailyWithdrawal, dailyDeposit, dailyPurchase, dailyCardTransaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LimitsAttributesCardLimits {\n"); + sb.append(" dailyWithdrawal: ").append(toIndentedString(dailyWithdrawal)).append("\n"); + sb.append(" dailyDeposit: ").append(toIndentedString(dailyDeposit)).append("\n"); + sb.append(" dailyPurchase: ").append(toIndentedString(dailyPurchase)).append("\n"); + sb.append(" dailyCardTransaction: ").append(toIndentedString(dailyCardTransaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dailyWithdrawal"); + openapiFields.add("dailyDeposit"); + openapiFields.add("dailyPurchase"); + openapiFields.add("dailyCardTransaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LimitsAttributesCardLimits + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LimitsAttributesCardLimits.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LimitsAttributesCardLimits is not found in the empty JSON string", LimitsAttributesCardLimits.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LimitsAttributesCardLimits.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LimitsAttributesCardLimits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LimitsAttributesCardLimits.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LimitsAttributesCardLimits' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LimitsAttributesCardLimits.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LimitsAttributesCardLimits value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LimitsAttributesCardLimits read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LimitsAttributesCardLimits given an JSON string + * + * @param jsonString JSON string + * @return An instance of LimitsAttributesCardLimits + * @throws IOException if the JSON string is invalid with respect to LimitsAttributesCardLimits + */ + public static LimitsAttributesCardLimits fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LimitsAttributesCardLimits.class); + } + + /** + * Convert an instance of LimitsAttributesCardLimits to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/LimitsAttributesCardTotalsDaily.java b/src/main/java/org/openapitools/client/model/LimitsAttributesCardTotalsDaily.java new file mode 100644 index 00000000..22d89add --- /dev/null +++ b/src/main/java/org/openapitools/client/model/LimitsAttributesCardTotalsDaily.java @@ -0,0 +1,290 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * LimitsAttributesCardTotalsDaily + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class LimitsAttributesCardTotalsDaily { + public static final String SERIALIZED_NAME_WITHDRAWAL = "withdrawal"; + @SerializedName(SERIALIZED_NAME_WITHDRAWAL) + private BigDecimal withdrawal; + + public static final String SERIALIZED_NAME_DEPOSIT = "deposit"; + @SerializedName(SERIALIZED_NAME_DEPOSIT) + private BigDecimal deposit; + + public static final String SERIALIZED_NAME_PURCHASE = "purchase"; + @SerializedName(SERIALIZED_NAME_PURCHASE) + private BigDecimal purchase; + + public static final String SERIALIZED_NAME_CARD_TRANSACTION = "cardTransaction"; + @SerializedName(SERIALIZED_NAME_CARD_TRANSACTION) + private BigDecimal cardTransaction; + + public LimitsAttributesCardTotalsDaily() { + } + + public LimitsAttributesCardTotalsDaily withdrawal(BigDecimal withdrawal) { + + this.withdrawal = withdrawal; + return this; + } + + /** + * Get withdrawal + * @return withdrawal + **/ + @javax.annotation.Nullable + public BigDecimal getWithdrawal() { + return withdrawal; + } + + + public void setWithdrawal(BigDecimal withdrawal) { + this.withdrawal = withdrawal; + } + + + public LimitsAttributesCardTotalsDaily deposit(BigDecimal deposit) { + + this.deposit = deposit; + return this; + } + + /** + * Get deposit + * @return deposit + **/ + @javax.annotation.Nullable + public BigDecimal getDeposit() { + return deposit; + } + + + public void setDeposit(BigDecimal deposit) { + this.deposit = deposit; + } + + + public LimitsAttributesCardTotalsDaily purchase(BigDecimal purchase) { + + this.purchase = purchase; + return this; + } + + /** + * Get purchase + * @return purchase + **/ + @javax.annotation.Nullable + public BigDecimal getPurchase() { + return purchase; + } + + + public void setPurchase(BigDecimal purchase) { + this.purchase = purchase; + } + + + public LimitsAttributesCardTotalsDaily cardTransaction(BigDecimal cardTransaction) { + + this.cardTransaction = cardTransaction; + return this; + } + + /** + * Get cardTransaction + * @return cardTransaction + **/ + @javax.annotation.Nullable + public BigDecimal getCardTransaction() { + return cardTransaction; + } + + + public void setCardTransaction(BigDecimal cardTransaction) { + this.cardTransaction = cardTransaction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LimitsAttributesCardTotalsDaily limitsAttributesCardTotalsDaily = (LimitsAttributesCardTotalsDaily) o; + return Objects.equals(this.withdrawal, limitsAttributesCardTotalsDaily.withdrawal) && + Objects.equals(this.deposit, limitsAttributesCardTotalsDaily.deposit) && + Objects.equals(this.purchase, limitsAttributesCardTotalsDaily.purchase) && + Objects.equals(this.cardTransaction, limitsAttributesCardTotalsDaily.cardTransaction); + } + + @Override + public int hashCode() { + return Objects.hash(withdrawal, deposit, purchase, cardTransaction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LimitsAttributesCardTotalsDaily {\n"); + sb.append(" withdrawal: ").append(toIndentedString(withdrawal)).append("\n"); + sb.append(" deposit: ").append(toIndentedString(deposit)).append("\n"); + sb.append(" purchase: ").append(toIndentedString(purchase)).append("\n"); + sb.append(" cardTransaction: ").append(toIndentedString(cardTransaction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("withdrawal"); + openapiFields.add("deposit"); + openapiFields.add("purchase"); + openapiFields.add("cardTransaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LimitsAttributesCardTotalsDaily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LimitsAttributesCardTotalsDaily.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LimitsAttributesCardTotalsDaily is not found in the empty JSON string", LimitsAttributesCardTotalsDaily.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LimitsAttributesCardTotalsDaily.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LimitsAttributesCardTotalsDaily` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LimitsAttributesCardTotalsDaily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LimitsAttributesCardTotalsDaily' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LimitsAttributesCardTotalsDaily.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LimitsAttributesCardTotalsDaily value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LimitsAttributesCardTotalsDaily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LimitsAttributesCardTotalsDaily given an JSON string + * + * @param jsonString JSON string + * @return An instance of LimitsAttributesCardTotalsDaily + * @throws IOException if the JSON string is invalid with respect to LimitsAttributesCardTotalsDaily + */ + public static LimitsAttributesCardTotalsDaily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LimitsAttributesCardTotalsDaily.class); + } + + /** + * Convert an instance of LimitsAttributesCardTotalsDaily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ListPageParametersObject.java b/src/main/java/org/openapitools/client/model/ListPageParametersObject.java new file mode 100644 index 00000000..6a93236e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ListPageParametersObject.java @@ -0,0 +1,244 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.*; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; + +import org.openapitools.client.JSON; +import org.openapitools.client.Pair; + +/** + * ListPageParametersObject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListPageParametersObject { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + private Integer limit = 100; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) + private Integer offset = 0; + + public ListPageParametersObject() { + } + + public ListPageParametersObject limit(Integer limit) { + + this.limit = limit; + return this; + } + + /** + * Get limit + * maximum: 1000 + * @return limit + **/ + @javax.annotation.Nullable + public Integer getLimit() { + return limit; + } + + + public void setLimit(Integer limit) { + this.limit = limit; + } + + + public ListPageParametersObject offset(Integer offset) { + + this.offset = offset; + return this; + } + + /** + * Get offset + * @return offset + **/ + @javax.annotation.Nullable + public Integer getOffset() { + return offset; + } + + + public void setOffset(Integer offset) { + this.offset = offset; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListPageParametersObject listPageParametersObject = (ListPageParametersObject) o; + return Objects.equals(this.limit, listPageParametersObject.limit) && + Objects.equals(this.offset, listPageParametersObject.offset); + } + + @Override + public int hashCode() { + return Objects.hash(limit, offset); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListPageParametersObject {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limit"); + openapiFields.add("offset"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListPageParametersObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListPageParametersObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListPageParametersObject is not found in the empty JSON string", ListPageParametersObject.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListPageParametersObject.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListPageParametersObject` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListPageParametersObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListPageParametersObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListPageParametersObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListPageParametersObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListPageParametersObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListPageParametersObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListPageParametersObject + * @throws IOException if the JSON string is invalid with respect to ListPageParametersObject + */ + public static ListPageParametersObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListPageParametersObject.class); + } + + /** + * Convert an instance of ListPageParametersObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } + + public List toParams() { + List params = new ArrayList<>(); + + if(this.offset != null){ + params.add(new Pair("page[offset]", this.offset.toString())); + } + + if(this.limit != null){ + params.add(new Pair("page[limit]", this.limit.toString())); + } + + return params; + } +} + diff --git a/src/main/java/org/openapitools/client/model/Merchant.java b/src/main/java/org/openapitools/client/model/Merchant.java new file mode 100644 index 00000000..5cb63db6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Merchant.java @@ -0,0 +1,339 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Merchant + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Merchant { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private Integer type; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + private String category; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + private String location; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public Merchant() { + } + + public Merchant name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Merchant type(Integer type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public Integer getType() { + return type; + } + + + public void setType(Integer type) { + this.type = type; + } + + + public Merchant category(String category) { + + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @javax.annotation.Nonnull + public String getCategory() { + return category; + } + + + public void setCategory(String category) { + this.category = category; + } + + + public Merchant location(String location) { + + this.location = location; + return this; + } + + /** + * Get location + * @return location + **/ + @javax.annotation.Nullable + public String getLocation() { + return location; + } + + + public void setLocation(String location) { + this.location = location; + } + + + public Merchant id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Merchant merchant = (Merchant) o; + return Objects.equals(this.name, merchant.name) && + Objects.equals(this.type, merchant.type) && + Objects.equals(this.category, merchant.category) && + Objects.equals(this.location, merchant.location) && + Objects.equals(this.id, merchant.id); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, category, location, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Merchant {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("category"); + openapiFields.add("location"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("category"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Merchant + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Merchant.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Merchant is not found in the empty JSON string", Merchant.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Merchant.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Merchant` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Merchant.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("category").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `category` to be a primitive type in the JSON string but got `%s`", jsonObj.get("category").toString())); + } + if ((jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) && !jsonObj.get("location").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `location` to be a primitive type in the JSON string but got `%s`", jsonObj.get("location").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Merchant.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Merchant' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Merchant.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Merchant value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Merchant read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Merchant given an JSON string + * + * @param jsonString JSON string + * @return An instance of Merchant + * @throws IOException if the JSON string is invalid with respect to Merchant + */ + public static Merchant fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Merchant.class); + } + + /** + * Convert an instance of Merchant to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/NegativeBalanceCoverageTransaction.java b/src/main/java/org/openapitools/client/model/NegativeBalanceCoverageTransaction.java new file mode 100644 index 00000000..2db6d498 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/NegativeBalanceCoverageTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FeeTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NegativeBalanceCoverageTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class NegativeBalanceCoverageTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private FeeTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public NegativeBalanceCoverageTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public NegativeBalanceCoverageTransaction attributes(FeeTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public FeeTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(FeeTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public NegativeBalanceCoverageTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NegativeBalanceCoverageTransaction negativeBalanceCoverageTransaction = (NegativeBalanceCoverageTransaction) o; + return Objects.equals(this.attributes, negativeBalanceCoverageTransaction.attributes) && + Objects.equals(this.relationships, negativeBalanceCoverageTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NegativeBalanceCoverageTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NegativeBalanceCoverageTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NegativeBalanceCoverageTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NegativeBalanceCoverageTransaction is not found in the empty JSON string", NegativeBalanceCoverageTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NegativeBalanceCoverageTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NegativeBalanceCoverageTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NegativeBalanceCoverageTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NegativeBalanceCoverageTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NegativeBalanceCoverageTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NegativeBalanceCoverageTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NegativeBalanceCoverageTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NegativeBalanceCoverageTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NegativeBalanceCoverageTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of NegativeBalanceCoverageTransaction + * @throws IOException if the JSON string is invalid with respect to NegativeBalanceCoverageTransaction + */ + public static NegativeBalanceCoverageTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NegativeBalanceCoverageTransaction.class); + } + + /** + * Convert an instance of NegativeBalanceCoverageTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Occupation.java b/src/main/java/org/openapitools/client/model/Occupation.java new file mode 100644 index 00000000..a1694760 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Occupation.java @@ -0,0 +1,114 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets occupation + */ +@JsonAdapter(Occupation.Adapter.class) +public enum Occupation { + + ARCHITECTORENGINEER("ArchitectOrEngineer"), + + BUSINESSANALYSTACCOUNTANTORFINANCIALADVISOR("BusinessAnalystAccountantOrFinancialAdvisor"), + + COMMUNITYANDSOCIALSERVICESWORKER("CommunityAndSocialServicesWorker"), + + CONSTRUCTIONMECHANICORMAINTENANCEWORKER("ConstructionMechanicOrMaintenanceWorker"), + + DOCTOR("Doctor"), + + EDUCATOR("Educator"), + + ENTERTAINMENTSPORTSARTSORMEDIA("EntertainmentSportsArtsOrMedia"), + + EXECUTIVEORMANAGER("ExecutiveOrManager"), + + FARMERFISHERMANFORESTER("FarmerFishermanForester"), + + FOODSERVICEWORKER("FoodServiceWorker"), + + GIGWORKER("GigWorker"), + + HOSPITALITYOFFICEORADMINISTRATIVESUPPORTWORKER("HospitalityOfficeOrAdministrativeSupportWorker"), + + HOUSEHOLDMANAGER("HouseholdManager"), + + JANITORHOUSEKEEPERLANDSCAPER("JanitorHousekeeperLandscaper"), + + LAWYER("Lawyer"), + + MANUFACTURINGORPRODUCTIONWORKER("ManufacturingOrProductionWorker"), + + MILITARYORPUBLICSAFETY("MilitaryOrPublicSafety"), + + NURSEHEALTHCARETECHNICIANORHEALTHCARESUPPORT("NurseHealthcareTechnicianOrHealthcareSupport"), + + PERSONALCAREORSERVICEWORKER("PersonalCareOrServiceWorker"), + + PILOTDRIVEROPERATOR("PilotDriverOperator"), + + SALESREPRESENTATIVEBROKERAGENT("SalesRepresentativeBrokerAgent"), + + SCIENTISTORTECHNOLOGIST("ScientistOrTechnologist"), + + STUDENT("Student"); + + private String value; + + Occupation(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Occupation fromValue(String value) { + for (Occupation b : Occupation.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final Occupation enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public Occupation read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return Occupation.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/Officer.java b/src/main/java/org/openapitools/client/model/Officer.java new file mode 100644 index 00000000..547c5fed --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Officer.java @@ -0,0 +1,547 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.SourceOfIncome; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Officer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Officer { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public Officer() { + } + + public Officer fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Officer ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public Officer passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public Officer nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public Officer matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public Officer address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public Officer dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public Officer phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public Officer email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Officer occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public Officer annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public Officer sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Officer officer = (Officer) o; + return Objects.equals(this.fullName, officer.fullName) && + Objects.equals(this.ssn, officer.ssn) && + Objects.equals(this.passport, officer.passport) && + Objects.equals(this.nationality, officer.nationality) && + Objects.equals(this.matriculaConsular, officer.matriculaConsular) && + Objects.equals(this.address, officer.address) && + Objects.equals(this.dateOfBirth, officer.dateOfBirth) && + Objects.equals(this.phone, officer.phone) && + Objects.equals(this.email, officer.email) && + Objects.equals(this.occupation, officer.occupation) && + Objects.equals(this.annualIncome, officer.annualIncome) && + Objects.equals(this.sourceOfIncome, officer.sourceOfIncome); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, phone, email, occupation, annualIncome, sourceOfIncome); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Officer {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Officer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Officer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Officer is not found in the empty JSON string", Officer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Officer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Officer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Officer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Officer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Officer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Officer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Officer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Officer given an JSON string + * + * @param jsonString JSON string + * @return An instance of Officer + * @throws IOException if the JSON string is invalid with respect to Officer + */ + public static Officer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Officer.class); + } + + /** + * Convert an instance of Officer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Officer1.java b/src/main/java/org/openapitools/client/model/Officer1.java new file mode 100644 index 00000000..9c5fae84 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Officer1.java @@ -0,0 +1,869 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.SourceOfIncome; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Officer1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Officer1 { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Object address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + /** + * Gets or Sets title + */ + @JsonAdapter(TitleEnum.Adapter.class) + public enum TitleEnum { + PRESIDENT("President"), + + CEO("CEO"), + + COO("COO"), + + CFO("CFO"), + + BENEFITSADMINISTRATIONOFFICER("BenefitsAdministrationOfficer"), + + CIO("CIO"), + + VP("VP"), + + AVP("AVP"), + + TREASURER("Treasurer"), + + SECRETARY("Secretary"), + + CONTROLLER("Controller"), + + MANAGER("Manager"), + + PARTNER("Partner"), + + MEMBER("Member"); + + private String value; + + TitleEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TitleEnum fromValue(String value) { + for (TitleEnum b : TitleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TitleEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TitleEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TitleEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private TitleEnum title; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_MASKED_S_S_N = "maskedSSN"; + @SerializedName(SERIALIZED_NAME_MASKED_S_S_N) + private String maskedSSN; + + public static final String SERIALIZED_NAME_MASKED_PASSPORT = "maskedPassport"; + @SerializedName(SERIALIZED_NAME_MASKED_PASSPORT) + private String maskedPassport; + + public static final String SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR = "maskedMatriculaConsular"; + @SerializedName(SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR) + private String maskedMatriculaConsular; + + public static final String SERIALIZED_NAME_ID_THEFT_SCORE = "idTheftScore"; + @SerializedName(SERIALIZED_NAME_ID_THEFT_SCORE) + private Integer idTheftScore; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public Officer1() { + } + + public Officer1 status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public Officer1 fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Officer1 email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Officer1 phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public Officer1 ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public Officer1 passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public Officer1 nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public Officer1 matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public Officer1 address(Object address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Object getAddress() { + return address; + } + + + public void setAddress(Object address) { + this.address = address; + } + + + public Officer1 dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public Officer1 evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public Officer1 title(TitleEnum title) { + + this.title = title; + return this; + } + + /** + * Get title + * @return title + **/ + @javax.annotation.Nullable + public TitleEnum getTitle() { + return title; + } + + + public void setTitle(TitleEnum title) { + this.title = title; + } + + + public Officer1 evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public Officer1 addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public Officer1 maskedSSN(String maskedSSN) { + + this.maskedSSN = maskedSSN; + return this; + } + + /** + * Get maskedSSN + * @return maskedSSN + **/ + @javax.annotation.Nullable + public String getMaskedSSN() { + return maskedSSN; + } + + + public void setMaskedSSN(String maskedSSN) { + this.maskedSSN = maskedSSN; + } + + + public Officer1 maskedPassport(String maskedPassport) { + + this.maskedPassport = maskedPassport; + return this; + } + + /** + * Get maskedPassport + * @return maskedPassport + **/ + @javax.annotation.Nullable + public String getMaskedPassport() { + return maskedPassport; + } + + + public void setMaskedPassport(String maskedPassport) { + this.maskedPassport = maskedPassport; + } + + + public Officer1 maskedMatriculaConsular(String maskedMatriculaConsular) { + + this.maskedMatriculaConsular = maskedMatriculaConsular; + return this; + } + + /** + * Get maskedMatriculaConsular + * @return maskedMatriculaConsular + **/ + @javax.annotation.Nullable + public String getMaskedMatriculaConsular() { + return maskedMatriculaConsular; + } + + + public void setMaskedMatriculaConsular(String maskedMatriculaConsular) { + this.maskedMatriculaConsular = maskedMatriculaConsular; + } + + + public Officer1 idTheftScore(Integer idTheftScore) { + + this.idTheftScore = idTheftScore; + return this; + } + + /** + * Get idTheftScore + * @return idTheftScore + **/ + @javax.annotation.Nullable + public Integer getIdTheftScore() { + return idTheftScore; + } + + + public void setIdTheftScore(Integer idTheftScore) { + this.idTheftScore = idTheftScore; + } + + + public Officer1 occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public Officer1 annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public Officer1 sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Officer1 officer1 = (Officer1) o; + return Objects.equals(this.status, officer1.status) && + Objects.equals(this.fullName, officer1.fullName) && + Objects.equals(this.email, officer1.email) && + Objects.equals(this.phone, officer1.phone) && + Objects.equals(this.ssn, officer1.ssn) && + Objects.equals(this.passport, officer1.passport) && + Objects.equals(this.nationality, officer1.nationality) && + Objects.equals(this.matriculaConsular, officer1.matriculaConsular) && + Objects.equals(this.address, officer1.address) && + Objects.equals(this.dateOfBirth, officer1.dateOfBirth) && + Objects.equals(this.evaluationId, officer1.evaluationId) && + Objects.equals(this.title, officer1.title) && + Objects.equals(this.evaluationFlags, officer1.evaluationFlags) && + Objects.equals(this.maskedSSN, officer1.maskedSSN) && + Objects.equals(this.maskedPassport, officer1.maskedPassport) && + Objects.equals(this.maskedMatriculaConsular, officer1.maskedMatriculaConsular) && + Objects.equals(this.idTheftScore, officer1.idTheftScore) && + Objects.equals(this.occupation, officer1.occupation) && + Objects.equals(this.annualIncome, officer1.annualIncome) && + Objects.equals(this.sourceOfIncome, officer1.sourceOfIncome); + } + + @Override + public int hashCode() { + return Objects.hash(status, fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, evaluationId, title, evaluationFlags, maskedSSN, maskedPassport, maskedMatriculaConsular, idTheftScore, occupation, annualIncome, sourceOfIncome); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Officer1 {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" maskedSSN: ").append(toIndentedString(maskedSSN)).append("\n"); + sb.append(" maskedPassport: ").append(toIndentedString(maskedPassport)).append("\n"); + sb.append(" maskedMatriculaConsular: ").append(toIndentedString(maskedMatriculaConsular)).append("\n"); + sb.append(" idTheftScore: ").append(toIndentedString(idTheftScore)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("evaluationId"); + openapiFields.add("title"); + openapiFields.add("evaluationFlags"); + openapiFields.add("maskedSSN"); + openapiFields.add("maskedPassport"); + openapiFields.add("maskedMatriculaConsular"); + openapiFields.add("idTheftScore"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Officer1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Officer1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Officer1 is not found in the empty JSON string", Officer1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Officer1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Officer1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + if ((jsonObj.get("maskedSSN") != null && !jsonObj.get("maskedSSN").isJsonNull()) && !jsonObj.get("maskedSSN").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedSSN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedSSN").toString())); + } + if ((jsonObj.get("maskedPassport") != null && !jsonObj.get("maskedPassport").isJsonNull()) && !jsonObj.get("maskedPassport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedPassport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedPassport").toString())); + } + if ((jsonObj.get("maskedMatriculaConsular") != null && !jsonObj.get("maskedMatriculaConsular").isJsonNull()) && !jsonObj.get("maskedMatriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedMatriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedMatriculaConsular").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Officer1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Officer1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Officer1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Officer1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Officer1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Officer1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Officer1 + * @throws IOException if the JSON string is invalid with respect to Officer1 + */ + public static Officer1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Officer1.class); + } + + /** + * Convert an instance of Officer1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/OrgRelationship.java b/src/main/java/org/openapitools/client/model/OrgRelationship.java new file mode 100644 index 00000000..7e0f3343 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/OrgRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.OrgRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OrgRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OrgRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private OrgRelationshipData data; + + public OrgRelationship() { + } + + public OrgRelationship data(OrgRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public OrgRelationshipData getData() { + return data; + } + + + public void setData(OrgRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrgRelationship orgRelationship = (OrgRelationship) o; + return Objects.equals(this.data, orgRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrgRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrgRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrgRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrgRelationship is not found in the empty JSON string", OrgRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrgRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrgRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrgRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + OrgRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrgRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrgRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrgRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrgRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrgRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrgRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrgRelationship + * @throws IOException if the JSON string is invalid with respect to OrgRelationship + */ + public static OrgRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrgRelationship.class); + } + + /** + * Convert an instance of OrgRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/OrgRelationshipData.java b/src/main/java/org/openapitools/client/model/OrgRelationshipData.java new file mode 100644 index 00000000..ab679174 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/OrgRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OrgRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OrgRelationshipData { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "org"; + + public OrgRelationshipData() { + } + + public OrgRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public OrgRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrgRelationshipData orgRelationshipData = (OrgRelationshipData) o; + return Objects.equals(this.id, orgRelationshipData.id) && + Objects.equals(this.type, orgRelationshipData.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrgRelationshipData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrgRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrgRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrgRelationshipData is not found in the empty JSON string", OrgRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrgRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrgRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrgRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrgRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrgRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrgRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrgRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrgRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrgRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrgRelationshipData + * @throws IOException if the JSON string is invalid with respect to OrgRelationshipData + */ + public static OrgRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrgRelationshipData.class); + } + + /** + * Convert an instance of OrgRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/OriginatedAchTransaction.java b/src/main/java/org/openapitools/client/model/OriginatedAchTransaction.java new file mode 100644 index 00000000..eb02658d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/OriginatedAchTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.OriginatedAchTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OriginatedAchTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OriginatedAchTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private OriginatedAchTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public OriginatedAchTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public OriginatedAchTransaction attributes(OriginatedAchTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public OriginatedAchTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(OriginatedAchTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public OriginatedAchTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OriginatedAchTransaction originatedAchTransaction = (OriginatedAchTransaction) o; + return Objects.equals(this.attributes, originatedAchTransaction.attributes) && + Objects.equals(this.relationships, originatedAchTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OriginatedAchTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OriginatedAchTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OriginatedAchTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OriginatedAchTransaction is not found in the empty JSON string", OriginatedAchTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OriginatedAchTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OriginatedAchTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OriginatedAchTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OriginatedAchTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OriginatedAchTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OriginatedAchTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OriginatedAchTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OriginatedAchTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OriginatedAchTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of OriginatedAchTransaction + * @throws IOException if the JSON string is invalid with respect to OriginatedAchTransaction + */ + public static OriginatedAchTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OriginatedAchTransaction.class); + } + + /** + * Convert an instance of OriginatedAchTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/OriginatedAchTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/OriginatedAchTransactionAllOfAttributes.java new file mode 100644 index 00000000..56946d8b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/OriginatedAchTransactionAllOfAttributes.java @@ -0,0 +1,568 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OriginatedAchTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OriginatedAchTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private String secCode; + + public static final String SERIALIZED_NAME_TRACE_NUMBER = "traceNumber"; + @SerializedName(SERIALIZED_NAME_TRACE_NUMBER) + private String traceNumber; + + public OriginatedAchTransactionAllOfAttributes() { + } + + public OriginatedAchTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public OriginatedAchTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public OriginatedAchTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public OriginatedAchTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public OriginatedAchTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public OriginatedAchTransactionAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public OriginatedAchTransactionAllOfAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public OriginatedAchTransactionAllOfAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public OriginatedAchTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public OriginatedAchTransactionAllOfAttributes secCode(String secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public String getSecCode() { + return secCode; + } + + + public void setSecCode(String secCode) { + this.secCode = secCode; + } + + + public OriginatedAchTransactionAllOfAttributes traceNumber(String traceNumber) { + + this.traceNumber = traceNumber; + return this; + } + + /** + * Get traceNumber + * @return traceNumber + **/ + @javax.annotation.Nullable + public String getTraceNumber() { + return traceNumber; + } + + + public void setTraceNumber(String traceNumber) { + this.traceNumber = traceNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OriginatedAchTransactionAllOfAttributes originatedAchTransactionAllOfAttributes = (OriginatedAchTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, originatedAchTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, originatedAchTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, originatedAchTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, originatedAchTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, originatedAchTransactionAllOfAttributes.summary) && + Objects.equals(this.description, originatedAchTransactionAllOfAttributes.description) && + Objects.equals(this.addenda, originatedAchTransactionAllOfAttributes.addenda) && + Objects.equals(this.counterparty, originatedAchTransactionAllOfAttributes.counterparty) && + Objects.equals(this.tags, originatedAchTransactionAllOfAttributes.tags) && + Objects.equals(this.secCode, originatedAchTransactionAllOfAttributes.secCode) && + Objects.equals(this.traceNumber, originatedAchTransactionAllOfAttributes.traceNumber); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, description, addenda, counterparty, tags, secCode, traceNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OriginatedAchTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append(" traceNumber: ").append(toIndentedString(traceNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("counterparty"); + openapiFields.add("tags"); + openapiFields.add("secCode"); + openapiFields.add("traceNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OriginatedAchTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OriginatedAchTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OriginatedAchTransactionAllOfAttributes is not found in the empty JSON string", OriginatedAchTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OriginatedAchTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OriginatedAchTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OriginatedAchTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + // validate the required field `counterparty` + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + if ((jsonObj.get("traceNumber") != null && !jsonObj.get("traceNumber").isJsonNull()) && !jsonObj.get("traceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `traceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OriginatedAchTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OriginatedAchTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OriginatedAchTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OriginatedAchTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OriginatedAchTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OriginatedAchTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of OriginatedAchTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to OriginatedAchTransactionAllOfAttributes + */ + public static OriginatedAchTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OriginatedAchTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of OriginatedAchTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaginationMeta.java b/src/main/java/org/openapitools/client/model/PaginationMeta.java new file mode 100644 index 00000000..2f9ab9e4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaginationMeta.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PaginationMetaPagination; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaginationMeta + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaginationMeta { + public static final String SERIALIZED_NAME_PAGINATION = "pagination"; + @SerializedName(SERIALIZED_NAME_PAGINATION) + private PaginationMetaPagination pagination; + + public PaginationMeta() { + } + + public PaginationMeta pagination(PaginationMetaPagination pagination) { + + this.pagination = pagination; + return this; + } + + /** + * Get pagination + * @return pagination + **/ + @javax.annotation.Nullable + public PaginationMetaPagination getPagination() { + return pagination; + } + + + public void setPagination(PaginationMetaPagination pagination) { + this.pagination = pagination; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaginationMeta paginationMeta = (PaginationMeta) o; + return Objects.equals(this.pagination, paginationMeta.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaginationMeta {\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("pagination"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaginationMeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaginationMeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaginationMeta is not found in the empty JSON string", PaginationMeta.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaginationMeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaginationMeta` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `pagination` + if (jsonObj.get("pagination") != null && !jsonObj.get("pagination").isJsonNull()) { + PaginationMetaPagination.validateJsonElement(jsonObj.get("pagination")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaginationMeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaginationMeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaginationMeta.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaginationMeta value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaginationMeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaginationMeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaginationMeta + * @throws IOException if the JSON string is invalid with respect to PaginationMeta + */ + public static PaginationMeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaginationMeta.class); + } + + /** + * Convert an instance of PaginationMeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaginationMetaPagination.java b/src/main/java/org/openapitools/client/model/PaginationMetaPagination.java new file mode 100644 index 00000000..90415f20 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaginationMetaPagination.java @@ -0,0 +1,261 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaginationMetaPagination + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaginationMetaPagination { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + private Integer limit; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) + private Integer offset; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Integer total; + + public PaginationMetaPagination() { + } + + public PaginationMetaPagination limit(Integer limit) { + + this.limit = limit; + return this; + } + + /** + * Get limit + * @return limit + **/ + @javax.annotation.Nullable + public Integer getLimit() { + return limit; + } + + + public void setLimit(Integer limit) { + this.limit = limit; + } + + + public PaginationMetaPagination offset(Integer offset) { + + this.offset = offset; + return this; + } + + /** + * Get offset + * @return offset + **/ + @javax.annotation.Nullable + public Integer getOffset() { + return offset; + } + + + public void setOffset(Integer offset) { + this.offset = offset; + } + + + public PaginationMetaPagination total(Integer total) { + + this.total = total; + return this; + } + + /** + * Get total + * @return total + **/ + @javax.annotation.Nullable + public Integer getTotal() { + return total; + } + + + public void setTotal(Integer total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaginationMetaPagination paginationMetaPagination = (PaginationMetaPagination) o; + return Objects.equals(this.limit, paginationMetaPagination.limit) && + Objects.equals(this.offset, paginationMetaPagination.offset) && + Objects.equals(this.total, paginationMetaPagination.total); + } + + @Override + public int hashCode() { + return Objects.hash(limit, offset, total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaginationMetaPagination {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limit"); + openapiFields.add("offset"); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaginationMetaPagination + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaginationMetaPagination.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaginationMetaPagination is not found in the empty JSON string", PaginationMetaPagination.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaginationMetaPagination.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaginationMetaPagination` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaginationMetaPagination.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaginationMetaPagination' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaginationMetaPagination.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaginationMetaPagination value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaginationMetaPagination read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaginationMetaPagination given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaginationMetaPagination + * @throws IOException if the JSON string is invalid with respect to PaginationMetaPagination + */ + public static PaginationMetaPagination fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaginationMetaPagination.class); + } + + /** + * Convert an instance of PaginationMetaPagination to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchAccount.java b/src/main/java/org/openapitools/client/model/PatchAccount.java new file mode 100644 index 00000000..a7a2a85a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private PatchAccountData data; + + public PatchAccount() { + } + + public PatchAccount data(PatchAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public PatchAccountData getData() { + return data; + } + + + public void setData(PatchAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchAccount patchAccount = (PatchAccount) o; + return Objects.equals(this.data, patchAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchAccount is not found in the empty JSON string", PatchAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PatchAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchAccount + * @throws IOException if the JSON string is invalid with respect to PatchAccount + */ + public static PatchAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchAccount.class); + } + + /** + * Convert an instance of PatchAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchAccountData.java b/src/main/java/org/openapitools/client/model/PatchAccountData.java new file mode 100644 index 00000000..88624051 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchAccountData.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateCreditAccount; +import org.openapitools.client.model.UpdateCreditAccountAttributes; +import org.openapitools.client.model.UpdateDepositAccount; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchAccountData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(PatchAccountData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUpdateDepositAccount = gson.getDelegateAdapter(this, TypeToken.get(UpdateDepositAccount.class)); + final TypeAdapter adapterUpdateCreditAccount = gson.getDelegateAdapter(this, TypeToken.get(UpdateCreditAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchAccountData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UpdateDepositAccount` + if (value.getActualInstance() instanceof UpdateDepositAccount) { + JsonElement element = adapterUpdateDepositAccount.toJsonTree((UpdateDepositAccount)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateCreditAccount` + if (value.getActualInstance() instanceof UpdateCreditAccount) { + JsonElement element = adapterUpdateCreditAccount.toJsonTree((UpdateCreditAccount)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: UpdateCreditAccount, UpdateDepositAccount"); + } + + @Override + public PatchAccountData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UpdateDepositAccount + try { + // validate the JSON object to see if any exception is thrown + UpdateDepositAccount.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateDepositAccount; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateDepositAccount'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UpdateDepositAccount failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateDepositAccount'", e); + } + // deserialize UpdateCreditAccount + try { + // validate the JSON object to see if any exception is thrown + UpdateCreditAccount.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateCreditAccount; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateCreditAccount'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UpdateCreditAccount failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateCreditAccount'", e); + } + + if (match == 1) { + PatchAccountData ret = new PatchAccountData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for PatchAccountData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public PatchAccountData() { + super("oneOf", Boolean.FALSE); + } + + public PatchAccountData(UpdateCreditAccount o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PatchAccountData(UpdateDepositAccount o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UpdateDepositAccount", UpdateDepositAccount.class); + schemas.put("UpdateCreditAccount", UpdateCreditAccount.class); + } + + @Override + public Map> getSchemas() { + return PatchAccountData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * UpdateCreditAccount, UpdateDepositAccount + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof UpdateDepositAccount) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateCreditAccount) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be UpdateCreditAccount, UpdateDepositAccount"); + } + + /** + * Get the actual instance, which can be the following: + * UpdateCreditAccount, UpdateDepositAccount + * + * @return The actual instance (UpdateCreditAccount, UpdateDepositAccount) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateDepositAccount`. If the actual instance is not `UpdateDepositAccount`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateDepositAccount` + * @throws ClassCastException if the instance is not `UpdateDepositAccount` + */ + public UpdateDepositAccount getUpdateDepositAccount() throws ClassCastException { + return (UpdateDepositAccount)super.getActualInstance(); + } + /** + * Get the actual instance of `UpdateCreditAccount`. If the actual instance is not `UpdateCreditAccount`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateCreditAccount` + * @throws ClassCastException if the instance is not `UpdateCreditAccount` + */ + public UpdateCreditAccount getUpdateCreditAccount() throws ClassCastException { + return (UpdateCreditAccount)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with UpdateDepositAccount + try { + UpdateDepositAccount.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for UpdateDepositAccount failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateCreditAccount + try { + UpdateCreditAccount.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for UpdateCreditAccount failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for PatchAccountData with oneOf schemas: UpdateCreditAccount, UpdateDepositAccount. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of PatchAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchAccountData + * @throws IOException if the JSON string is invalid with respect to PatchAccountData + */ + public static PatchAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchAccountData.class); + } + + /** + * Convert an instance of PatchAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchAchPayment.java b/src/main/java/org/openapitools/client/model/PatchAchPayment.java new file mode 100644 index 00000000..eddb0533 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchAchPayment.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchAchPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchAchPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "achPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchTrustApplicationAttributes attributes; + + public PatchAchPayment() { + } + + public PatchAchPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchAchPayment attributes(PatchTrustApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchTrustApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchTrustApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchAchPayment patchAchPayment = (PatchAchPayment) o; + return Objects.equals(this.type, patchAchPayment.type) && + Objects.equals(this.attributes, patchAchPayment.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchAchPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchAchPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchAchPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchAchPayment is not found in the empty JSON string", PatchAchPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchAchPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchAchPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchAchPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchTrustApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchAchPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchAchPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchAchPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchAchPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchAchPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchAchPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchAchPayment + * @throws IOException if the JSON string is invalid with respect to PatchAchPayment + */ + public static PatchAchPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchAchPayment.class); + } + + /** + * Convert an instance of PatchAchPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchAchReceivedPayment.java b/src/main/java/org/openapitools/client/model/PatchAchReceivedPayment.java new file mode 100644 index 00000000..f01d9539 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchAchReceivedPayment.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchAchReceivedPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchAchReceivedPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "achReceivedPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchTrustApplicationAttributes attributes; + + public PatchAchReceivedPayment() { + } + + public PatchAchReceivedPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchAchReceivedPayment attributes(PatchTrustApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchTrustApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchTrustApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchAchReceivedPayment patchAchReceivedPayment = (PatchAchReceivedPayment) o; + return Objects.equals(this.type, patchAchReceivedPayment.type) && + Objects.equals(this.attributes, patchAchReceivedPayment.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchAchReceivedPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchAchReceivedPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchAchReceivedPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchAchReceivedPayment is not found in the empty JSON string", PatchAchReceivedPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchAchReceivedPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchAchReceivedPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchAchReceivedPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchTrustApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchAchReceivedPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchAchReceivedPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchAchReceivedPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchAchReceivedPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchAchReceivedPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchAchReceivedPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchAchReceivedPayment + * @throws IOException if the JSON string is invalid with respect to PatchAchReceivedPayment + */ + public static PatchAchReceivedPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchAchReceivedPayment.class); + } + + /** + * Convert an instance of PatchAchReceivedPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBookPayment.java b/src/main/java/org/openapitools/client/model/PatchBookPayment.java new file mode 100644 index 00000000..82ec56bf --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBookPayment.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBookPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBookPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "bookPayment"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchTrustApplicationAttributes attributes; + + public PatchBookPayment() { + } + + public PatchBookPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchBookPayment attributes(PatchTrustApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchTrustApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchTrustApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBookPayment patchBookPayment = (PatchBookPayment) o; + return Objects.equals(this.type, patchBookPayment.type) && + Objects.equals(this.attributes, patchBookPayment.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBookPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBookPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBookPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBookPayment is not found in the empty JSON string", PatchBookPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBookPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBookPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBookPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchTrustApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBookPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBookPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBookPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBookPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBookPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBookPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBookPayment + * @throws IOException if the JSON string is invalid with respect to PatchBookPayment + */ + public static PatchBookPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBookPayment.class); + } + + /** + * Convert an instance of PatchBookPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBookTransaction.java b/src/main/java/org/openapitools/client/model/PatchBookTransaction.java new file mode 100644 index 00000000..d2eb43cd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBookTransaction.java @@ -0,0 +1,281 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBookTransactionAttributes; +import org.openapitools.client.model.PatchBookTransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBookTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBookTransaction { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "bookTransaction"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBookTransactionAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private PatchBookTransactionRelationships relationships; + + public PatchBookTransaction() { + } + + public PatchBookTransaction type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchBookTransaction attributes(PatchBookTransactionAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBookTransactionAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBookTransactionAttributes attributes) { + this.attributes = attributes; + } + + + public PatchBookTransaction relationships(PatchBookTransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public PatchBookTransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(PatchBookTransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBookTransaction patchBookTransaction = (PatchBookTransaction) o; + return Objects.equals(this.type, patchBookTransaction.type) && + Objects.equals(this.attributes, patchBookTransaction.attributes) && + Objects.equals(this.relationships, patchBookTransaction.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBookTransaction {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBookTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBookTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBookTransaction is not found in the empty JSON string", PatchBookTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBookTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBookTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBookTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBookTransactionAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + PatchBookTransactionRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBookTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBookTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBookTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBookTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBookTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBookTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBookTransaction + * @throws IOException if the JSON string is invalid with respect to PatchBookTransaction + */ + public static PatchBookTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBookTransaction.class); + } + + /** + * Convert an instance of PatchBookTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBookTransactionAttributes.java b/src/main/java/org/openapitools/client/model/PatchBookTransactionAttributes.java new file mode 100644 index 00000000..3262d58a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBookTransactionAttributes.java @@ -0,0 +1,236 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBookTransactionAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBookTransactionAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public PatchBookTransactionAttributes() { + } + + public PatchBookTransactionAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchBookTransactionAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nullable + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBookTransactionAttributes patchBookTransactionAttributes = (PatchBookTransactionAttributes) o; + return Objects.equals(this.tags, patchBookTransactionAttributes.tags) && + Objects.equals(this.summary, patchBookTransactionAttributes.summary); + } + + @Override + public int hashCode() { + return Objects.hash(tags, summary); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBookTransactionAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + openapiFields.add("summary"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBookTransactionAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBookTransactionAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBookTransactionAttributes is not found in the empty JSON string", PatchBookTransactionAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBookTransactionAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBookTransactionAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("summary") != null && !jsonObj.get("summary").isJsonNull()) && !jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBookTransactionAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBookTransactionAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBookTransactionAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBookTransactionAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBookTransactionAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBookTransactionAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBookTransactionAttributes + * @throws IOException if the JSON string is invalid with respect to PatchBookTransactionAttributes + */ + public static PatchBookTransactionAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBookTransactionAttributes.class); + } + + /** + * Convert an instance of PatchBookTransactionAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBookTransactionRelationships.java b/src/main/java/org/openapitools/client/model/PatchBookTransactionRelationships.java new file mode 100644 index 00000000..c7c432c4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBookTransactionRelationships.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationship1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBookTransactionRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBookTransactionRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AccountRelationship1 account; + + public PatchBookTransactionRelationships() { + } + + public PatchBookTransactionRelationships account(AccountRelationship1 account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public AccountRelationship1 getAccount() { + return account; + } + + + public void setAccount(AccountRelationship1 account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBookTransactionRelationships patchBookTransactionRelationships = (PatchBookTransactionRelationships) o; + return Objects.equals(this.account, patchBookTransactionRelationships.account); + } + + @Override + public int hashCode() { + return Objects.hash(account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBookTransactionRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBookTransactionRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBookTransactionRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBookTransactionRelationships is not found in the empty JSON string", PatchBookTransactionRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBookTransactionRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBookTransactionRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBookTransactionRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + AccountRelationship1.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBookTransactionRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBookTransactionRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBookTransactionRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBookTransactionRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBookTransactionRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBookTransactionRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBookTransactionRelationships + * @throws IOException if the JSON string is invalid with respect to PatchBookTransactionRelationships + */ + public static PatchBookTransactionRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBookTransactionRelationships.class); + } + + /** + * Convert an instance of PatchBookTransactionRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessApplication.java b/src/main/java/org/openapitools/client/model/PatchBusinessApplication.java new file mode 100644 index 00000000..65559fb0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "businessApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBusinessApplicationAttributes attributes; + + public PatchBusinessApplication() { + } + + public PatchBusinessApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchBusinessApplication attributes(PatchBusinessApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBusinessApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBusinessApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessApplication patchBusinessApplication = (PatchBusinessApplication) o; + return Objects.equals(this.type, patchBusinessApplication.type) && + Objects.equals(this.attributes, patchBusinessApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessApplication is not found in the empty JSON string", PatchBusinessApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBusinessApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBusinessApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessApplication + * @throws IOException if the JSON string is invalid with respect to PatchBusinessApplication + */ + public static PatchBusinessApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessApplication.class); + } + + /** + * Convert an instance of PatchBusinessApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessApplicationAttributes.java b/src/main/java/org/openapitools/client/model/PatchBusinessApplicationAttributes.java new file mode 100644 index 00000000..f2ed7a73 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessApplicationAttributes.java @@ -0,0 +1,509 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.BeneficialOwner; +import org.openapitools.client.model.BusinessAnnualRevenue; +import org.openapitools.client.model.BusinessNumberOfEmployees; +import org.openapitools.client.model.BusinessVertical; +import org.openapitools.client.model.CashFlow; +import org.openapitools.client.model.Officer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessApplicationAttributes { + public static final String SERIALIZED_NAME_OFFICER = "officer"; + @SerializedName(SERIALIZED_NAME_OFFICER) + private Officer officer; + + public static final String SERIALIZED_NAME_BENEFICIAL_OWNERS = "beneficialOwners"; + @SerializedName(SERIALIZED_NAME_BENEFICIAL_OWNERS) + private List beneficialOwners; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_ANNUAL_REVENUE = "annualRevenue"; + @SerializedName(SERIALIZED_NAME_ANNUAL_REVENUE) + private BusinessAnnualRevenue annualRevenue; + + public static final String SERIALIZED_NAME_NUMBER_OF_EMPLOYEES = "numberOfEmployees"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_EMPLOYEES) + private BusinessNumberOfEmployees numberOfEmployees; + + public static final String SERIALIZED_NAME_CASH_FLOW = "cashFlow"; + @SerializedName(SERIALIZED_NAME_CASH_FLOW) + private CashFlow cashFlow; + + public static final String SERIALIZED_NAME_YEAR_OF_INCORPORATION = "yearOfIncorporation"; + @SerializedName(SERIALIZED_NAME_YEAR_OF_INCORPORATION) + private String yearOfIncorporation; + + public static final String SERIALIZED_NAME_COUNTRIES_OF_OPERATION = "countriesOfOperation"; + @SerializedName(SERIALIZED_NAME_COUNTRIES_OF_OPERATION) + private List countriesOfOperation; + + public static final String SERIALIZED_NAME_STOCK_SYMBOL = "stockSymbol"; + @SerializedName(SERIALIZED_NAME_STOCK_SYMBOL) + private String stockSymbol; + + public static final String SERIALIZED_NAME_BUSINESS_VERTICAL = "businessVertical"; + @SerializedName(SERIALIZED_NAME_BUSINESS_VERTICAL) + private BusinessVertical businessVertical; + + public PatchBusinessApplicationAttributes() { + } + + public PatchBusinessApplicationAttributes officer(Officer officer) { + + this.officer = officer; + return this; + } + + /** + * Get officer + * @return officer + **/ + @javax.annotation.Nullable + public Officer getOfficer() { + return officer; + } + + + public void setOfficer(Officer officer) { + this.officer = officer; + } + + + public PatchBusinessApplicationAttributes beneficialOwners(List beneficialOwners) { + + this.beneficialOwners = beneficialOwners; + return this; + } + + public PatchBusinessApplicationAttributes addBeneficialOwnersItem(BeneficialOwner beneficialOwnersItem) { + if (this.beneficialOwners == null) { + this.beneficialOwners = new ArrayList<>(); + } + this.beneficialOwners.add(beneficialOwnersItem); + return this; + } + + /** + * Get beneficialOwners + * @return beneficialOwners + **/ + @javax.annotation.Nullable + public List getBeneficialOwners() { + return beneficialOwners; + } + + + public void setBeneficialOwners(List beneficialOwners) { + this.beneficialOwners = beneficialOwners; + } + + + public PatchBusinessApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchBusinessApplicationAttributes annualRevenue(BusinessAnnualRevenue annualRevenue) { + + this.annualRevenue = annualRevenue; + return this; + } + + /** + * Get annualRevenue + * @return annualRevenue + **/ + @javax.annotation.Nullable + public BusinessAnnualRevenue getAnnualRevenue() { + return annualRevenue; + } + + + public void setAnnualRevenue(BusinessAnnualRevenue annualRevenue) { + this.annualRevenue = annualRevenue; + } + + + public PatchBusinessApplicationAttributes numberOfEmployees(BusinessNumberOfEmployees numberOfEmployees) { + + this.numberOfEmployees = numberOfEmployees; + return this; + } + + /** + * Get numberOfEmployees + * @return numberOfEmployees + **/ + @javax.annotation.Nullable + public BusinessNumberOfEmployees getNumberOfEmployees() { + return numberOfEmployees; + } + + + public void setNumberOfEmployees(BusinessNumberOfEmployees numberOfEmployees) { + this.numberOfEmployees = numberOfEmployees; + } + + + public PatchBusinessApplicationAttributes cashFlow(CashFlow cashFlow) { + + this.cashFlow = cashFlow; + return this; + } + + /** + * Get cashFlow + * @return cashFlow + **/ + @javax.annotation.Nullable + public CashFlow getCashFlow() { + return cashFlow; + } + + + public void setCashFlow(CashFlow cashFlow) { + this.cashFlow = cashFlow; + } + + + public PatchBusinessApplicationAttributes yearOfIncorporation(String yearOfIncorporation) { + + this.yearOfIncorporation = yearOfIncorporation; + return this; + } + + /** + * Get yearOfIncorporation + * @return yearOfIncorporation + **/ + @javax.annotation.Nullable + public String getYearOfIncorporation() { + return yearOfIncorporation; + } + + + public void setYearOfIncorporation(String yearOfIncorporation) { + this.yearOfIncorporation = yearOfIncorporation; + } + + + public PatchBusinessApplicationAttributes countriesOfOperation(List countriesOfOperation) { + + this.countriesOfOperation = countriesOfOperation; + return this; + } + + public PatchBusinessApplicationAttributes addCountriesOfOperationItem(String countriesOfOperationItem) { + if (this.countriesOfOperation == null) { + this.countriesOfOperation = new ArrayList<>(); + } + this.countriesOfOperation.add(countriesOfOperationItem); + return this; + } + + /** + * Get countriesOfOperation + * @return countriesOfOperation + **/ + @javax.annotation.Nullable + public List getCountriesOfOperation() { + return countriesOfOperation; + } + + + public void setCountriesOfOperation(List countriesOfOperation) { + this.countriesOfOperation = countriesOfOperation; + } + + + public PatchBusinessApplicationAttributes stockSymbol(String stockSymbol) { + + this.stockSymbol = stockSymbol; + return this; + } + + /** + * Get stockSymbol + * @return stockSymbol + **/ + @javax.annotation.Nullable + public String getStockSymbol() { + return stockSymbol; + } + + + public void setStockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + } + + + public PatchBusinessApplicationAttributes businessVertical(BusinessVertical businessVertical) { + + this.businessVertical = businessVertical; + return this; + } + + /** + * Get businessVertical + * @return businessVertical + **/ + @javax.annotation.Nullable + public BusinessVertical getBusinessVertical() { + return businessVertical; + } + + + public void setBusinessVertical(BusinessVertical businessVertical) { + this.businessVertical = businessVertical; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessApplicationAttributes patchBusinessApplicationAttributes = (PatchBusinessApplicationAttributes) o; + return Objects.equals(this.officer, patchBusinessApplicationAttributes.officer) && + Objects.equals(this.beneficialOwners, patchBusinessApplicationAttributes.beneficialOwners) && + Objects.equals(this.tags, patchBusinessApplicationAttributes.tags) && + Objects.equals(this.annualRevenue, patchBusinessApplicationAttributes.annualRevenue) && + Objects.equals(this.numberOfEmployees, patchBusinessApplicationAttributes.numberOfEmployees) && + Objects.equals(this.cashFlow, patchBusinessApplicationAttributes.cashFlow) && + Objects.equals(this.yearOfIncorporation, patchBusinessApplicationAttributes.yearOfIncorporation) && + Objects.equals(this.countriesOfOperation, patchBusinessApplicationAttributes.countriesOfOperation) && + Objects.equals(this.stockSymbol, patchBusinessApplicationAttributes.stockSymbol) && + Objects.equals(this.businessVertical, patchBusinessApplicationAttributes.businessVertical); + } + + @Override + public int hashCode() { + return Objects.hash(officer, beneficialOwners, tags, annualRevenue, numberOfEmployees, cashFlow, yearOfIncorporation, countriesOfOperation, stockSymbol, businessVertical); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessApplicationAttributes {\n"); + sb.append(" officer: ").append(toIndentedString(officer)).append("\n"); + sb.append(" beneficialOwners: ").append(toIndentedString(beneficialOwners)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" annualRevenue: ").append(toIndentedString(annualRevenue)).append("\n"); + sb.append(" numberOfEmployees: ").append(toIndentedString(numberOfEmployees)).append("\n"); + sb.append(" cashFlow: ").append(toIndentedString(cashFlow)).append("\n"); + sb.append(" yearOfIncorporation: ").append(toIndentedString(yearOfIncorporation)).append("\n"); + sb.append(" countriesOfOperation: ").append(toIndentedString(countriesOfOperation)).append("\n"); + sb.append(" stockSymbol: ").append(toIndentedString(stockSymbol)).append("\n"); + sb.append(" businessVertical: ").append(toIndentedString(businessVertical)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("officer"); + openapiFields.add("beneficialOwners"); + openapiFields.add("tags"); + openapiFields.add("annualRevenue"); + openapiFields.add("numberOfEmployees"); + openapiFields.add("cashFlow"); + openapiFields.add("yearOfIncorporation"); + openapiFields.add("countriesOfOperation"); + openapiFields.add("stockSymbol"); + openapiFields.add("businessVertical"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessApplicationAttributes is not found in the empty JSON string", PatchBusinessApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `officer` + if (jsonObj.get("officer") != null && !jsonObj.get("officer").isJsonNull()) { + Officer.validateJsonElement(jsonObj.get("officer")); + } + if (jsonObj.get("beneficialOwners") != null && !jsonObj.get("beneficialOwners").isJsonNull()) { + JsonArray jsonArraybeneficialOwners = jsonObj.getAsJsonArray("beneficialOwners"); + if (jsonArraybeneficialOwners != null) { + // ensure the json data is an array + if (!jsonObj.get("beneficialOwners").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficialOwners` to be an array in the JSON string but got `%s`", jsonObj.get("beneficialOwners").toString())); + } + + // validate the optional field `beneficialOwners` (array) + for (int i = 0; i < jsonArraybeneficialOwners.size(); i++) { + BeneficialOwner.validateJsonElement(jsonArraybeneficialOwners.get(i)); + }; + } + } + if ((jsonObj.get("yearOfIncorporation") != null && !jsonObj.get("yearOfIncorporation").isJsonNull()) && !jsonObj.get("yearOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `yearOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yearOfIncorporation").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("countriesOfOperation") != null && !jsonObj.get("countriesOfOperation").isJsonNull() && !jsonObj.get("countriesOfOperation").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `countriesOfOperation` to be an array in the JSON string but got `%s`", jsonObj.get("countriesOfOperation").toString())); + } + if ((jsonObj.get("stockSymbol") != null && !jsonObj.get("stockSymbol").isJsonNull()) && !jsonObj.get("stockSymbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stockSymbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stockSymbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to PatchBusinessApplicationAttributes + */ + public static PatchBusinessApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessApplicationAttributes.class); + } + + /** + * Convert an instance of PatchBusinessApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessCreditCard.java b/src/main/java/org/openapitools/client/model/PatchBusinessCreditCard.java new file mode 100644 index 00000000..906e4fcc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessCreditCard.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessCreditCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessCreditCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSCREDITCARD("businessCreditCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBusinessDebitCardAttributes attributes; + + public PatchBusinessCreditCard() { + } + + public PatchBusinessCreditCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public PatchBusinessCreditCard attributes(PatchBusinessDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBusinessDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBusinessDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessCreditCard patchBusinessCreditCard = (PatchBusinessCreditCard) o; + return Objects.equals(this.type, patchBusinessCreditCard.type) && + Objects.equals(this.attributes, patchBusinessCreditCard.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessCreditCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessCreditCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessCreditCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessCreditCard is not found in the empty JSON string", PatchBusinessCreditCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessCreditCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessCreditCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBusinessCreditCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBusinessDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessCreditCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessCreditCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessCreditCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessCreditCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessCreditCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessCreditCard + * @throws IOException if the JSON string is invalid with respect to PatchBusinessCreditCard + */ + public static PatchBusinessCreditCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessCreditCard.class); + } + + /** + * Convert an instance of PatchBusinessCreditCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessDebitCard.java b/src/main/java/org/openapitools/client/model/PatchBusinessDebitCard.java new file mode 100644 index 00000000..ee17bbf8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessDebitCard.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSDEBITCARD("businessDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBusinessDebitCardAttributes attributes; + + public PatchBusinessDebitCard() { + } + + public PatchBusinessDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public PatchBusinessDebitCard attributes(PatchBusinessDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBusinessDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBusinessDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessDebitCard patchBusinessDebitCard = (PatchBusinessDebitCard) o; + return Objects.equals(this.type, patchBusinessDebitCard.type) && + Objects.equals(this.attributes, patchBusinessDebitCard.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessDebitCard is not found in the empty JSON string", PatchBusinessDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBusinessDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBusinessDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessDebitCard + * @throws IOException if the JSON string is invalid with respect to PatchBusinessDebitCard + */ + public static PatchBusinessDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessDebitCard.class); + } + + /** + * Convert an instance of PatchBusinessDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/PatchBusinessDebitCardAttributes.java new file mode 100644 index 00000000..d204ec84 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessDebitCardAttributes.java @@ -0,0 +1,441 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.CardLevelLimits; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessDebitCardAttributes { + public static final String SERIALIZED_NAME_SHIPPING_ADDRESS = "shippingAddress"; + @SerializedName(SERIALIZED_NAME_SHIPPING_ADDRESS) + private Address shippingAddress; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_DESIGN = "design"; + @SerializedName(SERIALIZED_NAME_DESIGN) + private String design; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID = "defaultFundingAccountId"; + @SerializedName(SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID) + private String defaultFundingAccountId; + + public PatchBusinessDebitCardAttributes() { + } + + public PatchBusinessDebitCardAttributes shippingAddress(Address shippingAddress) { + + this.shippingAddress = shippingAddress; + return this; + } + + /** + * Get shippingAddress + * @return shippingAddress + **/ + @javax.annotation.Nullable + public Address getShippingAddress() { + return shippingAddress; + } + + + public void setShippingAddress(Address shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public PatchBusinessDebitCardAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public PatchBusinessDebitCardAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public PatchBusinessDebitCardAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public PatchBusinessDebitCardAttributes design(String design) { + + this.design = design; + return this; + } + + /** + * Get design + * @return design + **/ + @javax.annotation.Nullable + public String getDesign() { + return design; + } + + + public void setDesign(String design) { + this.design = design; + } + + + public PatchBusinessDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchBusinessDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public PatchBusinessDebitCardAttributes defaultFundingAccountId(String defaultFundingAccountId) { + + this.defaultFundingAccountId = defaultFundingAccountId; + return this; + } + + /** + * Get defaultFundingAccountId + * @return defaultFundingAccountId + **/ + @javax.annotation.Nullable + public String getDefaultFundingAccountId() { + return defaultFundingAccountId; + } + + + public void setDefaultFundingAccountId(String defaultFundingAccountId) { + this.defaultFundingAccountId = defaultFundingAccountId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessDebitCardAttributes patchBusinessDebitCardAttributes = (PatchBusinessDebitCardAttributes) o; + return Objects.equals(this.shippingAddress, patchBusinessDebitCardAttributes.shippingAddress) && + Objects.equals(this.address, patchBusinessDebitCardAttributes.address) && + Objects.equals(this.phone, patchBusinessDebitCardAttributes.phone) && + Objects.equals(this.email, patchBusinessDebitCardAttributes.email) && + Objects.equals(this.design, patchBusinessDebitCardAttributes.design) && + Objects.equals(this.tags, patchBusinessDebitCardAttributes.tags) && + Objects.equals(this.limits, patchBusinessDebitCardAttributes.limits) && + Objects.equals(this.defaultFundingAccountId, patchBusinessDebitCardAttributes.defaultFundingAccountId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(shippingAddress, address, phone, email, design, tags, limits, defaultFundingAccountId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessDebitCardAttributes {\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" design: ").append(toIndentedString(design)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" defaultFundingAccountId: ").append(toIndentedString(defaultFundingAccountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingAddress"); + openapiFields.add("address"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("design"); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("defaultFundingAccountId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessDebitCardAttributes is not found in the empty JSON string", PatchBusinessDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `shippingAddress` + if (jsonObj.get("shippingAddress") != null && !jsonObj.get("shippingAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("shippingAddress")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("design") != null && !jsonObj.get("design").isJsonNull()) && !jsonObj.get("design").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `design` to be a primitive type in the JSON string but got `%s`", jsonObj.get("design").toString())); + } + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("defaultFundingAccountId") != null && !jsonObj.get("defaultFundingAccountId").isJsonNull()) && !jsonObj.get("defaultFundingAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `defaultFundingAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("defaultFundingAccountId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to PatchBusinessDebitCardAttributes + */ + public static PatchBusinessDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessDebitCardAttributes.class); + } + + /** + * Convert an instance of PatchBusinessDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessVirtualCreditCard.java b/src/main/java/org/openapitools/client/model/PatchBusinessVirtualCreditCard.java new file mode 100644 index 00000000..333e8f4e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessVirtualCreditCard.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessVirtualDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessVirtualCreditCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessVirtualCreditCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSVIRTUALCREDITCARD("businessVirtualCreditCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBusinessVirtualDebitCardAttributes attributes; + + public PatchBusinessVirtualCreditCard() { + } + + public PatchBusinessVirtualCreditCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public PatchBusinessVirtualCreditCard attributes(PatchBusinessVirtualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBusinessVirtualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBusinessVirtualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessVirtualCreditCard patchBusinessVirtualCreditCard = (PatchBusinessVirtualCreditCard) o; + return Objects.equals(this.type, patchBusinessVirtualCreditCard.type) && + Objects.equals(this.attributes, patchBusinessVirtualCreditCard.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessVirtualCreditCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessVirtualCreditCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessVirtualCreditCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessVirtualCreditCard is not found in the empty JSON string", PatchBusinessVirtualCreditCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessVirtualCreditCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessVirtualCreditCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBusinessVirtualCreditCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBusinessVirtualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessVirtualCreditCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessVirtualCreditCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessVirtualCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessVirtualCreditCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessVirtualCreditCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessVirtualCreditCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessVirtualCreditCard + * @throws IOException if the JSON string is invalid with respect to PatchBusinessVirtualCreditCard + */ + public static PatchBusinessVirtualCreditCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessVirtualCreditCard.class); + } + + /** + * Convert an instance of PatchBusinessVirtualCreditCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessVirtualDebitCard.java b/src/main/java/org/openapitools/client/model/PatchBusinessVirtualDebitCard.java new file mode 100644 index 00000000..2da81b28 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessVirtualDebitCard.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessVirtualDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessVirtualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessVirtualDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSVIRTUALDEBITCARD("businessVirtualDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBusinessVirtualDebitCardAttributes attributes; + + public PatchBusinessVirtualDebitCard() { + } + + public PatchBusinessVirtualDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public PatchBusinessVirtualDebitCard attributes(PatchBusinessVirtualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBusinessVirtualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBusinessVirtualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessVirtualDebitCard patchBusinessVirtualDebitCard = (PatchBusinessVirtualDebitCard) o; + return Objects.equals(this.type, patchBusinessVirtualDebitCard.type) && + Objects.equals(this.attributes, patchBusinessVirtualDebitCard.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessVirtualDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessVirtualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessVirtualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessVirtualDebitCard is not found in the empty JSON string", PatchBusinessVirtualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessVirtualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessVirtualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchBusinessVirtualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBusinessVirtualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessVirtualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessVirtualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessVirtualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessVirtualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessVirtualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessVirtualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessVirtualDebitCard + * @throws IOException if the JSON string is invalid with respect to PatchBusinessVirtualDebitCard + */ + public static PatchBusinessVirtualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessVirtualDebitCard.class); + } + + /** + * Convert an instance of PatchBusinessVirtualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchBusinessVirtualDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/PatchBusinessVirtualDebitCardAttributes.java new file mode 100644 index 00000000..8ebd0cda --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchBusinessVirtualDebitCardAttributes.java @@ -0,0 +1,366 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.CardLevelLimits; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchBusinessVirtualDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchBusinessVirtualDebitCardAttributes { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID = "defaultFundingAccountId"; + @SerializedName(SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID) + private String defaultFundingAccountId; + + public PatchBusinessVirtualDebitCardAttributes() { + } + + public PatchBusinessVirtualDebitCardAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public PatchBusinessVirtualDebitCardAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public PatchBusinessVirtualDebitCardAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public PatchBusinessVirtualDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchBusinessVirtualDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public PatchBusinessVirtualDebitCardAttributes defaultFundingAccountId(String defaultFundingAccountId) { + + this.defaultFundingAccountId = defaultFundingAccountId; + return this; + } + + /** + * Get defaultFundingAccountId + * @return defaultFundingAccountId + **/ + @javax.annotation.Nullable + public String getDefaultFundingAccountId() { + return defaultFundingAccountId; + } + + + public void setDefaultFundingAccountId(String defaultFundingAccountId) { + this.defaultFundingAccountId = defaultFundingAccountId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBusinessVirtualDebitCardAttributes patchBusinessVirtualDebitCardAttributes = (PatchBusinessVirtualDebitCardAttributes) o; + return Objects.equals(this.address, patchBusinessVirtualDebitCardAttributes.address) && + Objects.equals(this.phone, patchBusinessVirtualDebitCardAttributes.phone) && + Objects.equals(this.email, patchBusinessVirtualDebitCardAttributes.email) && + Objects.equals(this.tags, patchBusinessVirtualDebitCardAttributes.tags) && + Objects.equals(this.limits, patchBusinessVirtualDebitCardAttributes.limits) && + Objects.equals(this.defaultFundingAccountId, patchBusinessVirtualDebitCardAttributes.defaultFundingAccountId); + } + + @Override + public int hashCode() { + return Objects.hash(address, phone, email, tags, limits, defaultFundingAccountId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBusinessVirtualDebitCardAttributes {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" defaultFundingAccountId: ").append(toIndentedString(defaultFundingAccountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("phone"); + openapiFields.add("email"); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("defaultFundingAccountId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBusinessVirtualDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBusinessVirtualDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBusinessVirtualDebitCardAttributes is not found in the empty JSON string", PatchBusinessVirtualDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBusinessVirtualDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBusinessVirtualDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("defaultFundingAccountId") != null && !jsonObj.get("defaultFundingAccountId").isJsonNull()) && !jsonObj.get("defaultFundingAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `defaultFundingAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("defaultFundingAccountId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBusinessVirtualDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBusinessVirtualDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessVirtualDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBusinessVirtualDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBusinessVirtualDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBusinessVirtualDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBusinessVirtualDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to PatchBusinessVirtualDebitCardAttributes + */ + public static PatchBusinessVirtualDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBusinessVirtualDebitCardAttributes.class); + } + + /** + * Convert an instance of PatchBusinessVirtualDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchChargebackTransaction.java b/src/main/java/org/openapitools/client/model/PatchChargebackTransaction.java new file mode 100644 index 00000000..48f64bf7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchChargebackTransaction.java @@ -0,0 +1,281 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBookTransactionAttributes; +import org.openapitools.client.model.PatchBookTransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchChargebackTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchChargebackTransaction { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "chargebackTransaction"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchBookTransactionAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private PatchBookTransactionRelationships relationships; + + public PatchChargebackTransaction() { + } + + public PatchChargebackTransaction type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchChargebackTransaction attributes(PatchBookTransactionAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchBookTransactionAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchBookTransactionAttributes attributes) { + this.attributes = attributes; + } + + + public PatchChargebackTransaction relationships(PatchBookTransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public PatchBookTransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(PatchBookTransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchChargebackTransaction patchChargebackTransaction = (PatchChargebackTransaction) o; + return Objects.equals(this.type, patchChargebackTransaction.type) && + Objects.equals(this.attributes, patchChargebackTransaction.attributes) && + Objects.equals(this.relationships, patchChargebackTransaction.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchChargebackTransaction {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchChargebackTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchChargebackTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchChargebackTransaction is not found in the empty JSON string", PatchChargebackTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchChargebackTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchChargebackTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchChargebackTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchBookTransactionAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the optional field `relationships` + if (jsonObj.get("relationships") != null && !jsonObj.get("relationships").isJsonNull()) { + PatchBookTransactionRelationships.validateJsonElement(jsonObj.get("relationships")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchChargebackTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchChargebackTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchChargebackTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchChargebackTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchChargebackTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchChargebackTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchChargebackTransaction + * @throws IOException if the JSON string is invalid with respect to PatchChargebackTransaction + */ + public static PatchChargebackTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchChargebackTransaction.class); + } + + /** + * Convert an instance of PatchChargebackTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchCheckDeposit.java b/src/main/java/org/openapitools/client/model/PatchCheckDeposit.java new file mode 100644 index 00000000..2e1d22a1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchCheckDeposit.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchCheckDepositAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchCheckDeposit + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCheckDeposit { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "checkDeposit"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchCheckDepositAttributes attributes; + + public PatchCheckDeposit() { + } + + public PatchCheckDeposit type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchCheckDeposit attributes(PatchCheckDepositAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchCheckDepositAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchCheckDepositAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchCheckDeposit patchCheckDeposit = (PatchCheckDeposit) o; + return Objects.equals(this.type, patchCheckDeposit.type) && + Objects.equals(this.attributes, patchCheckDeposit.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCheckDeposit {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchCheckDeposit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCheckDeposit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchCheckDeposit is not found in the empty JSON string", PatchCheckDeposit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchCheckDeposit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchCheckDeposit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchCheckDeposit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchCheckDepositAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCheckDeposit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCheckDeposit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCheckDeposit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCheckDeposit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchCheckDeposit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchCheckDeposit given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCheckDeposit + * @throws IOException if the JSON string is invalid with respect to PatchCheckDeposit + */ + public static PatchCheckDeposit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCheckDeposit.class); + } + + /** + * Convert an instance of PatchCheckDeposit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchCheckDepositAttributes.java b/src/main/java/org/openapitools/client/model/PatchCheckDepositAttributes.java new file mode 100644 index 00000000..d9fe1e59 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchCheckDepositAttributes.java @@ -0,0 +1,234 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchCheckDepositAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCheckDepositAttributes { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public PatchCheckDepositAttributes() { + } + + public PatchCheckDepositAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nullable + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public PatchCheckDepositAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchCheckDepositAttributes patchCheckDepositAttributes = (PatchCheckDepositAttributes) o; + return Objects.equals(this.amount, patchCheckDepositAttributes.amount) && + Objects.equals(this.tags, patchCheckDepositAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(amount, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCheckDepositAttributes {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchCheckDepositAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCheckDepositAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchCheckDepositAttributes is not found in the empty JSON string", PatchCheckDepositAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchCheckDepositAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchCheckDepositAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCheckDepositAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCheckDepositAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCheckDepositAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCheckDepositAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchCheckDepositAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchCheckDepositAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCheckDepositAttributes + * @throws IOException if the JSON string is invalid with respect to PatchCheckDepositAttributes + */ + public static PatchCheckDepositAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCheckDepositAttributes.class); + } + + /** + * Convert an instance of PatchCheckDepositAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchCounterparty.java b/src/main/java/org/openapitools/client/model/PatchCounterparty.java new file mode 100644 index 00000000..a1e7fdad --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchCounterparty.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchCounterpartyAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCounterparty { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "counterparty"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchCounterpartyAttributes attributes; + + public PatchCounterparty() { + } + + public PatchCounterparty type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchCounterparty attributes(PatchCounterpartyAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchCounterpartyAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchCounterpartyAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchCounterparty patchCounterparty = (PatchCounterparty) o; + return Objects.equals(this.type, patchCounterparty.type) && + Objects.equals(this.attributes, patchCounterparty.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCounterparty {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchCounterparty is not found in the empty JSON string", PatchCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchCounterpartyAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCounterparty + * @throws IOException if the JSON string is invalid with respect to PatchCounterparty + */ + public static PatchCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCounterparty.class); + } + + /** + * Convert an instance of PatchCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchCounterpartyAttributes.java b/src/main/java/org/openapitools/client/model/PatchCounterpartyAttributes.java new file mode 100644 index 00000000..0d310dee --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchCounterpartyAttributes.java @@ -0,0 +1,375 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchCounterpartyAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCounterpartyAttributes { + public static final String SERIALIZED_NAME_PLAID_PROCESSOR_TOKEN = "plaidProcessorToken"; + @SerializedName(SERIALIZED_NAME_PLAID_PROCESSOR_TOKEN) + private String plaidProcessorToken; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + /** + * Gets or Sets permissions + */ + @JsonAdapter(PermissionsEnum.Adapter.class) + public enum PermissionsEnum { + CREDITONLY("CreditOnly"), + + DEBITONLY("DebitOnly"), + + CREDITANDDEBIT("CreditAndDebit"); + + private String value; + + PermissionsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PermissionsEnum fromValue(String value) { + for (PermissionsEnum b : PermissionsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PermissionsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PermissionsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PermissionsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private PermissionsEnum permissions; + + public static final String SERIALIZED_NAME_VERIFY_NAME = "verifyName"; + @SerializedName(SERIALIZED_NAME_VERIFY_NAME) + private Boolean verifyName = false; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public PatchCounterpartyAttributes() { + } + + public PatchCounterpartyAttributes plaidProcessorToken(String plaidProcessorToken) { + + this.plaidProcessorToken = plaidProcessorToken; + return this; + } + + /** + * Get plaidProcessorToken + * @return plaidProcessorToken + **/ + @javax.annotation.Nullable + public String getPlaidProcessorToken() { + return plaidProcessorToken; + } + + + public void setPlaidProcessorToken(String plaidProcessorToken) { + this.plaidProcessorToken = plaidProcessorToken; + } + + + public PatchCounterpartyAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public PatchCounterpartyAttributes permissions(PermissionsEnum permissions) { + + this.permissions = permissions; + return this; + } + + /** + * Get permissions + * @return permissions + **/ + @javax.annotation.Nullable + public PermissionsEnum getPermissions() { + return permissions; + } + + + public void setPermissions(PermissionsEnum permissions) { + this.permissions = permissions; + } + + + public PatchCounterpartyAttributes verifyName(Boolean verifyName) { + + this.verifyName = verifyName; + return this; + } + + /** + * Get verifyName + * @return verifyName + **/ + @javax.annotation.Nullable + public Boolean getVerifyName() { + return verifyName; + } + + + public void setVerifyName(Boolean verifyName) { + this.verifyName = verifyName; + } + + + public PatchCounterpartyAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchCounterpartyAttributes patchCounterpartyAttributes = (PatchCounterpartyAttributes) o; + return Objects.equals(this.plaidProcessorToken, patchCounterpartyAttributes.plaidProcessorToken) && + Objects.equals(this.name, patchCounterpartyAttributes.name) && + Objects.equals(this.permissions, patchCounterpartyAttributes.permissions) && + Objects.equals(this.verifyName, patchCounterpartyAttributes.verifyName) && + Objects.equals(this.tags, patchCounterpartyAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(plaidProcessorToken, name, permissions, verifyName, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCounterpartyAttributes {\n"); + sb.append(" plaidProcessorToken: ").append(toIndentedString(plaidProcessorToken)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" verifyName: ").append(toIndentedString(verifyName)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("plaidProcessorToken"); + openapiFields.add("name"); + openapiFields.add("permissions"); + openapiFields.add("verifyName"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchCounterpartyAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCounterpartyAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchCounterpartyAttributes is not found in the empty JSON string", PatchCounterpartyAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchCounterpartyAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchCounterpartyAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("plaidProcessorToken") != null && !jsonObj.get("plaidProcessorToken").isJsonNull()) && !jsonObj.get("plaidProcessorToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `plaidProcessorToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("plaidProcessorToken").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) && !jsonObj.get("permissions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCounterpartyAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCounterpartyAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCounterpartyAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCounterpartyAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchCounterpartyAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchCounterpartyAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCounterpartyAttributes + * @throws IOException if the JSON string is invalid with respect to PatchCounterpartyAttributes + */ + public static PatchCounterpartyAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCounterpartyAttributes.class); + } + + /** + * Convert an instance of PatchCounterpartyAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchIndividualApplication.java b/src/main/java/org/openapitools/client/model/PatchIndividualApplication.java new file mode 100644 index 00000000..d459167c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchIndividualApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchIndividualApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchIndividualApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchIndividualApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "individualApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchIndividualApplicationAttributes attributes; + + public PatchIndividualApplication() { + } + + public PatchIndividualApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchIndividualApplication attributes(PatchIndividualApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchIndividualApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchIndividualApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIndividualApplication patchIndividualApplication = (PatchIndividualApplication) o; + return Objects.equals(this.type, patchIndividualApplication.type) && + Objects.equals(this.attributes, patchIndividualApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchIndividualApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchIndividualApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchIndividualApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchIndividualApplication is not found in the empty JSON string", PatchIndividualApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchIndividualApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchIndividualApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchIndividualApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchIndividualApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchIndividualApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchIndividualApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchIndividualApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchIndividualApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchIndividualApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchIndividualApplication + * @throws IOException if the JSON string is invalid with respect to PatchIndividualApplication + */ + public static PatchIndividualApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchIndividualApplication.class); + } + + /** + * Convert an instance of PatchIndividualApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchIndividualApplicationAttributes.java b/src/main/java/org/openapitools/client/model/PatchIndividualApplicationAttributes.java new file mode 100644 index 00000000..f9fe3b3d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchIndividualApplicationAttributes.java @@ -0,0 +1,410 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AnnualIncome; +import org.openapitools.client.model.BusinessVertical; +import org.openapitools.client.model.Occupation; +import org.openapitools.client.model.SoleProprietorshipAnnualRevenue; +import org.openapitools.client.model.SoleProprietorshipNumberOfEmployees; +import org.openapitools.client.model.SourceOfIncome; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchIndividualApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchIndividualApplicationAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_OCCUPATION = "occupation"; + @SerializedName(SERIALIZED_NAME_OCCUPATION) + private Occupation occupation; + + public static final String SERIALIZED_NAME_ANNUAL_INCOME = "annualIncome"; + @SerializedName(SERIALIZED_NAME_ANNUAL_INCOME) + private AnnualIncome annualIncome; + + public static final String SERIALIZED_NAME_SOURCE_OF_INCOME = "sourceOfIncome"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_INCOME) + private SourceOfIncome sourceOfIncome; + + public static final String SERIALIZED_NAME_ANNUAL_REVENUE = "annualRevenue"; + @SerializedName(SERIALIZED_NAME_ANNUAL_REVENUE) + private SoleProprietorshipAnnualRevenue annualRevenue; + + public static final String SERIALIZED_NAME_NUMBER_OF_EMPLOYEES = "numberOfEmployees"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_EMPLOYEES) + private SoleProprietorshipNumberOfEmployees numberOfEmployees; + + public static final String SERIALIZED_NAME_BUSINESS_VERTICAL = "businessVertical"; + @SerializedName(SERIALIZED_NAME_BUSINESS_VERTICAL) + private BusinessVertical businessVertical; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; + + public PatchIndividualApplicationAttributes() { + } + + public PatchIndividualApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchIndividualApplicationAttributes occupation(Occupation occupation) { + + this.occupation = occupation; + return this; + } + + /** + * Get occupation + * @return occupation + **/ + @javax.annotation.Nullable + public Occupation getOccupation() { + return occupation; + } + + + public void setOccupation(Occupation occupation) { + this.occupation = occupation; + } + + + public PatchIndividualApplicationAttributes annualIncome(AnnualIncome annualIncome) { + + this.annualIncome = annualIncome; + return this; + } + + /** + * Get annualIncome + * @return annualIncome + **/ + @javax.annotation.Nullable + public AnnualIncome getAnnualIncome() { + return annualIncome; + } + + + public void setAnnualIncome(AnnualIncome annualIncome) { + this.annualIncome = annualIncome; + } + + + public PatchIndividualApplicationAttributes sourceOfIncome(SourceOfIncome sourceOfIncome) { + + this.sourceOfIncome = sourceOfIncome; + return this; + } + + /** + * Get sourceOfIncome + * @return sourceOfIncome + **/ + @javax.annotation.Nullable + public SourceOfIncome getSourceOfIncome() { + return sourceOfIncome; + } + + + public void setSourceOfIncome(SourceOfIncome sourceOfIncome) { + this.sourceOfIncome = sourceOfIncome; + } + + + public PatchIndividualApplicationAttributes annualRevenue(SoleProprietorshipAnnualRevenue annualRevenue) { + + this.annualRevenue = annualRevenue; + return this; + } + + /** + * Get annualRevenue + * @return annualRevenue + **/ + @javax.annotation.Nullable + public SoleProprietorshipAnnualRevenue getAnnualRevenue() { + return annualRevenue; + } + + + public void setAnnualRevenue(SoleProprietorshipAnnualRevenue annualRevenue) { + this.annualRevenue = annualRevenue; + } + + + public PatchIndividualApplicationAttributes numberOfEmployees(SoleProprietorshipNumberOfEmployees numberOfEmployees) { + + this.numberOfEmployees = numberOfEmployees; + return this; + } + + /** + * Get numberOfEmployees + * @return numberOfEmployees + **/ + @javax.annotation.Nullable + public SoleProprietorshipNumberOfEmployees getNumberOfEmployees() { + return numberOfEmployees; + } + + + public void setNumberOfEmployees(SoleProprietorshipNumberOfEmployees numberOfEmployees) { + this.numberOfEmployees = numberOfEmployees; + } + + + public PatchIndividualApplicationAttributes businessVertical(BusinessVertical businessVertical) { + + this.businessVertical = businessVertical; + return this; + } + + /** + * Get businessVertical + * @return businessVertical + **/ + @javax.annotation.Nullable + public BusinessVertical getBusinessVertical() { + return businessVertical; + } + + + public void setBusinessVertical(BusinessVertical businessVertical) { + this.businessVertical = businessVertical; + } + + + public PatchIndividualApplicationAttributes website(String website) { + + this.website = website; + return this; + } + + /** + * Get website + * @return website + **/ + @javax.annotation.Nullable + public String getWebsite() { + return website; + } + + + public void setWebsite(String website) { + this.website = website; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIndividualApplicationAttributes patchIndividualApplicationAttributes = (PatchIndividualApplicationAttributes) o; + return Objects.equals(this.tags, patchIndividualApplicationAttributes.tags) && + Objects.equals(this.occupation, patchIndividualApplicationAttributes.occupation) && + Objects.equals(this.annualIncome, patchIndividualApplicationAttributes.annualIncome) && + Objects.equals(this.sourceOfIncome, patchIndividualApplicationAttributes.sourceOfIncome) && + Objects.equals(this.annualRevenue, patchIndividualApplicationAttributes.annualRevenue) && + Objects.equals(this.numberOfEmployees, patchIndividualApplicationAttributes.numberOfEmployees) && + Objects.equals(this.businessVertical, patchIndividualApplicationAttributes.businessVertical) && + Objects.equals(this.website, patchIndividualApplicationAttributes.website); + } + + @Override + public int hashCode() { + return Objects.hash(tags, occupation, annualIncome, sourceOfIncome, annualRevenue, numberOfEmployees, businessVertical, website); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchIndividualApplicationAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" occupation: ").append(toIndentedString(occupation)).append("\n"); + sb.append(" annualIncome: ").append(toIndentedString(annualIncome)).append("\n"); + sb.append(" sourceOfIncome: ").append(toIndentedString(sourceOfIncome)).append("\n"); + sb.append(" annualRevenue: ").append(toIndentedString(annualRevenue)).append("\n"); + sb.append(" numberOfEmployees: ").append(toIndentedString(numberOfEmployees)).append("\n"); + sb.append(" businessVertical: ").append(toIndentedString(businessVertical)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + openapiFields.add("occupation"); + openapiFields.add("annualIncome"); + openapiFields.add("sourceOfIncome"); + openapiFields.add("annualRevenue"); + openapiFields.add("numberOfEmployees"); + openapiFields.add("businessVertical"); + openapiFields.add("website"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchIndividualApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchIndividualApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchIndividualApplicationAttributes is not found in the empty JSON string", PatchIndividualApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchIndividualApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchIndividualApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `website` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchIndividualApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchIndividualApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchIndividualApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchIndividualApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchIndividualApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchIndividualApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to PatchIndividualApplicationAttributes + */ + public static PatchIndividualApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchIndividualApplicationAttributes.class); + } + + /** + * Convert an instance of PatchIndividualApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchIndividualDebitCard.java b/src/main/java/org/openapitools/client/model/PatchIndividualDebitCard.java new file mode 100644 index 00000000..0422fb18 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchIndividualDebitCard.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchIndividualDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchIndividualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchIndividualDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + INDIVIDUALDEBITCARD("individualDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchIndividualDebitCardAttributes attributes; + + public PatchIndividualDebitCard() { + } + + public PatchIndividualDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public PatchIndividualDebitCard attributes(PatchIndividualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchIndividualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchIndividualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIndividualDebitCard patchIndividualDebitCard = (PatchIndividualDebitCard) o; + return Objects.equals(this.type, patchIndividualDebitCard.type) && + Objects.equals(this.attributes, patchIndividualDebitCard.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchIndividualDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchIndividualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchIndividualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchIndividualDebitCard is not found in the empty JSON string", PatchIndividualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchIndividualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchIndividualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchIndividualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchIndividualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchIndividualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchIndividualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchIndividualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchIndividualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchIndividualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchIndividualDebitCard + * @throws IOException if the JSON string is invalid with respect to PatchIndividualDebitCard + */ + public static PatchIndividualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchIndividualDebitCard.class); + } + + /** + * Convert an instance of PatchIndividualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchIndividualDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/PatchIndividualDebitCardAttributes.java new file mode 100644 index 00000000..65fdb998 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchIndividualDebitCardAttributes.java @@ -0,0 +1,345 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.CardLevelLimits; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchIndividualDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchIndividualDebitCardAttributes { + public static final String SERIALIZED_NAME_SHIPPING_ADDRESS = "shippingAddress"; + @SerializedName(SERIALIZED_NAME_SHIPPING_ADDRESS) + private Address shippingAddress; + + public static final String SERIALIZED_NAME_DESIGN = "design"; + @SerializedName(SERIALIZED_NAME_DESIGN) + private String design; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID = "defaultFundingAccountId"; + @SerializedName(SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID) + private String defaultFundingAccountId; + + public PatchIndividualDebitCardAttributes() { + } + + public PatchIndividualDebitCardAttributes shippingAddress(Address shippingAddress) { + + this.shippingAddress = shippingAddress; + return this; + } + + /** + * Get shippingAddress + * @return shippingAddress + **/ + @javax.annotation.Nullable + public Address getShippingAddress() { + return shippingAddress; + } + + + public void setShippingAddress(Address shippingAddress) { + this.shippingAddress = shippingAddress; + } + + + public PatchIndividualDebitCardAttributes design(String design) { + + this.design = design; + return this; + } + + /** + * Get design + * @return design + **/ + @javax.annotation.Nullable + public String getDesign() { + return design; + } + + + public void setDesign(String design) { + this.design = design; + } + + + public PatchIndividualDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchIndividualDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public PatchIndividualDebitCardAttributes defaultFundingAccountId(String defaultFundingAccountId) { + + this.defaultFundingAccountId = defaultFundingAccountId; + return this; + } + + /** + * Get defaultFundingAccountId + * @return defaultFundingAccountId + **/ + @javax.annotation.Nullable + public String getDefaultFundingAccountId() { + return defaultFundingAccountId; + } + + + public void setDefaultFundingAccountId(String defaultFundingAccountId) { + this.defaultFundingAccountId = defaultFundingAccountId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIndividualDebitCardAttributes patchIndividualDebitCardAttributes = (PatchIndividualDebitCardAttributes) o; + return Objects.equals(this.shippingAddress, patchIndividualDebitCardAttributes.shippingAddress) && + Objects.equals(this.design, patchIndividualDebitCardAttributes.design) && + Objects.equals(this.tags, patchIndividualDebitCardAttributes.tags) && + Objects.equals(this.limits, patchIndividualDebitCardAttributes.limits) && + Objects.equals(this.defaultFundingAccountId, patchIndividualDebitCardAttributes.defaultFundingAccountId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(shippingAddress, design, tags, limits, defaultFundingAccountId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchIndividualDebitCardAttributes {\n"); + sb.append(" shippingAddress: ").append(toIndentedString(shippingAddress)).append("\n"); + sb.append(" design: ").append(toIndentedString(design)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" defaultFundingAccountId: ").append(toIndentedString(defaultFundingAccountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingAddress"); + openapiFields.add("design"); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("defaultFundingAccountId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchIndividualDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchIndividualDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchIndividualDebitCardAttributes is not found in the empty JSON string", PatchIndividualDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchIndividualDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchIndividualDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `shippingAddress` + if (jsonObj.get("shippingAddress") != null && !jsonObj.get("shippingAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("shippingAddress")); + } + if ((jsonObj.get("design") != null && !jsonObj.get("design").isJsonNull()) && !jsonObj.get("design").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `design` to be a primitive type in the JSON string but got `%s`", jsonObj.get("design").toString())); + } + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("defaultFundingAccountId") != null && !jsonObj.get("defaultFundingAccountId").isJsonNull()) && !jsonObj.get("defaultFundingAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `defaultFundingAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("defaultFundingAccountId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchIndividualDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchIndividualDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchIndividualDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchIndividualDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchIndividualDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchIndividualDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to PatchIndividualDebitCardAttributes + */ + public static PatchIndividualDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchIndividualDebitCardAttributes.class); + } + + /** + * Convert an instance of PatchIndividualDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchIndividualVirtualDebitCard.java b/src/main/java/org/openapitools/client/model/PatchIndividualVirtualDebitCard.java new file mode 100644 index 00000000..6dd7851a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchIndividualVirtualDebitCard.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchIndividualVirtualDebitCardAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchIndividualVirtualDebitCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchIndividualVirtualDebitCard { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + INDIVIDUALVIRTUALDEBITCARD("individualVirtualDebitCard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchIndividualVirtualDebitCardAttributes attributes; + + public PatchIndividualVirtualDebitCard() { + } + + public PatchIndividualVirtualDebitCard type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public PatchIndividualVirtualDebitCard attributes(PatchIndividualVirtualDebitCardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchIndividualVirtualDebitCardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchIndividualVirtualDebitCardAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIndividualVirtualDebitCard patchIndividualVirtualDebitCard = (PatchIndividualVirtualDebitCard) o; + return Objects.equals(this.type, patchIndividualVirtualDebitCard.type) && + Objects.equals(this.attributes, patchIndividualVirtualDebitCard.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchIndividualVirtualDebitCard {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchIndividualVirtualDebitCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchIndividualVirtualDebitCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchIndividualVirtualDebitCard is not found in the empty JSON string", PatchIndividualVirtualDebitCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchIndividualVirtualDebitCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchIndividualVirtualDebitCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchIndividualVirtualDebitCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchIndividualVirtualDebitCardAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchIndividualVirtualDebitCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchIndividualVirtualDebitCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualVirtualDebitCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchIndividualVirtualDebitCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchIndividualVirtualDebitCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchIndividualVirtualDebitCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchIndividualVirtualDebitCard + * @throws IOException if the JSON string is invalid with respect to PatchIndividualVirtualDebitCard + */ + public static PatchIndividualVirtualDebitCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchIndividualVirtualDebitCard.class); + } + + /** + * Convert an instance of PatchIndividualVirtualDebitCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchIndividualVirtualDebitCardAttributes.java b/src/main/java/org/openapitools/client/model/PatchIndividualVirtualDebitCardAttributes.java new file mode 100644 index 00000000..119f0af2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchIndividualVirtualDebitCardAttributes.java @@ -0,0 +1,269 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CardLevelLimits; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchIndividualVirtualDebitCardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchIndividualVirtualDebitCardAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_LIMITS = "limits"; + @SerializedName(SERIALIZED_NAME_LIMITS) + private CardLevelLimits limits; + + public static final String SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID = "defaultFundingAccountId"; + @SerializedName(SERIALIZED_NAME_DEFAULT_FUNDING_ACCOUNT_ID) + private String defaultFundingAccountId; + + public PatchIndividualVirtualDebitCardAttributes() { + } + + public PatchIndividualVirtualDebitCardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PatchIndividualVirtualDebitCardAttributes limits(CardLevelLimits limits) { + + this.limits = limits; + return this; + } + + /** + * Get limits + * @return limits + **/ + @javax.annotation.Nullable + public CardLevelLimits getLimits() { + return limits; + } + + + public void setLimits(CardLevelLimits limits) { + this.limits = limits; + } + + + public PatchIndividualVirtualDebitCardAttributes defaultFundingAccountId(String defaultFundingAccountId) { + + this.defaultFundingAccountId = defaultFundingAccountId; + return this; + } + + /** + * Get defaultFundingAccountId + * @return defaultFundingAccountId + **/ + @javax.annotation.Nullable + public String getDefaultFundingAccountId() { + return defaultFundingAccountId; + } + + + public void setDefaultFundingAccountId(String defaultFundingAccountId) { + this.defaultFundingAccountId = defaultFundingAccountId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIndividualVirtualDebitCardAttributes patchIndividualVirtualDebitCardAttributes = (PatchIndividualVirtualDebitCardAttributes) o; + return Objects.equals(this.tags, patchIndividualVirtualDebitCardAttributes.tags) && + Objects.equals(this.limits, patchIndividualVirtualDebitCardAttributes.limits) && + Objects.equals(this.defaultFundingAccountId, patchIndividualVirtualDebitCardAttributes.defaultFundingAccountId); + } + + @Override + public int hashCode() { + return Objects.hash(tags, limits, defaultFundingAccountId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchIndividualVirtualDebitCardAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" limits: ").append(toIndentedString(limits)).append("\n"); + sb.append(" defaultFundingAccountId: ").append(toIndentedString(defaultFundingAccountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + openapiFields.add("limits"); + openapiFields.add("defaultFundingAccountId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchIndividualVirtualDebitCardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchIndividualVirtualDebitCardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchIndividualVirtualDebitCardAttributes is not found in the empty JSON string", PatchIndividualVirtualDebitCardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchIndividualVirtualDebitCardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchIndividualVirtualDebitCardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `limits` + if (jsonObj.get("limits") != null && !jsonObj.get("limits").isJsonNull()) { + CardLevelLimits.validateJsonElement(jsonObj.get("limits")); + } + if ((jsonObj.get("defaultFundingAccountId") != null && !jsonObj.get("defaultFundingAccountId").isJsonNull()) && !jsonObj.get("defaultFundingAccountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `defaultFundingAccountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("defaultFundingAccountId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchIndividualVirtualDebitCardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchIndividualVirtualDebitCardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualVirtualDebitCardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchIndividualVirtualDebitCardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchIndividualVirtualDebitCardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchIndividualVirtualDebitCardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchIndividualVirtualDebitCardAttributes + * @throws IOException if the JSON string is invalid with respect to PatchIndividualVirtualDebitCardAttributes + */ + public static PatchIndividualVirtualDebitCardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchIndividualVirtualDebitCardAttributes.class); + } + + /** + * Convert an instance of PatchIndividualVirtualDebitCardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchTransactionTags.java b/src/main/java/org/openapitools/client/model/PatchTransactionTags.java new file mode 100644 index 00000000..3929123a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchTransactionTags.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchTransactionTagsAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchTransactionTags + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchTransactionTags { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "transaction"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchTransactionTagsAttributes attributes; + + public PatchTransactionTags() { + } + + public PatchTransactionTags type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchTransactionTags attributes(PatchTransactionTagsAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchTransactionTagsAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchTransactionTagsAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchTransactionTags patchTransactionTags = (PatchTransactionTags) o; + return Objects.equals(this.type, patchTransactionTags.type) && + Objects.equals(this.attributes, patchTransactionTags.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchTransactionTags {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchTransactionTags + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchTransactionTags.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchTransactionTags is not found in the empty JSON string", PatchTransactionTags.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchTransactionTags.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchTransactionTags` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchTransactionTags.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchTransactionTagsAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchTransactionTags.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchTransactionTags' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchTransactionTags.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchTransactionTags value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchTransactionTags read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchTransactionTags given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchTransactionTags + * @throws IOException if the JSON string is invalid with respect to PatchTransactionTags + */ + public static PatchTransactionTags fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchTransactionTags.class); + } + + /** + * Convert an instance of PatchTransactionTags to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchTransactionTagsAttributes.java b/src/main/java/org/openapitools/client/model/PatchTransactionTagsAttributes.java new file mode 100644 index 00000000..878f356c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchTransactionTagsAttributes.java @@ -0,0 +1,213 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchTransactionTagsAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchTransactionTagsAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public PatchTransactionTagsAttributes() { + } + + public PatchTransactionTagsAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nonnull + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchTransactionTagsAttributes patchTransactionTagsAttributes = (PatchTransactionTagsAttributes) o; + return Objects.equals(this.tags, patchTransactionTagsAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchTransactionTagsAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tags"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchTransactionTagsAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchTransactionTagsAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchTransactionTagsAttributes is not found in the empty JSON string", PatchTransactionTagsAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchTransactionTagsAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchTransactionTagsAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchTransactionTagsAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchTransactionTagsAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchTransactionTagsAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchTransactionTagsAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchTransactionTagsAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchTransactionTagsAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchTransactionTagsAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchTransactionTagsAttributes + * @throws IOException if the JSON string is invalid with respect to PatchTransactionTagsAttributes + */ + public static PatchTransactionTagsAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchTransactionTagsAttributes.class); + } + + /** + * Convert an instance of PatchTransactionTagsAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchTrustApplication.java b/src/main/java/org/openapitools/client/model/PatchTrustApplication.java new file mode 100644 index 00000000..ca05efcb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchTrustApplication.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchTrustApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchTrustApplication { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "trustApplication"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PatchTrustApplicationAttributes attributes; + + public PatchTrustApplication() { + } + + public PatchTrustApplication type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PatchTrustApplication attributes(PatchTrustApplicationAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PatchTrustApplicationAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PatchTrustApplicationAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchTrustApplication patchTrustApplication = (PatchTrustApplication) o; + return Objects.equals(this.type, patchTrustApplication.type) && + Objects.equals(this.attributes, patchTrustApplication.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchTrustApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchTrustApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchTrustApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchTrustApplication is not found in the empty JSON string", PatchTrustApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchTrustApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchTrustApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchTrustApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + PatchTrustApplicationAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchTrustApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchTrustApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchTrustApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchTrustApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchTrustApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchTrustApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchTrustApplication + * @throws IOException if the JSON string is invalid with respect to PatchTrustApplication + */ + public static PatchTrustApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchTrustApplication.class); + } + + /** + * Convert an instance of PatchTrustApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PatchTrustApplicationAttributes.java b/src/main/java/org/openapitools/client/model/PatchTrustApplicationAttributes.java new file mode 100644 index 00000000..882166af --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PatchTrustApplicationAttributes.java @@ -0,0 +1,205 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PatchTrustApplicationAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchTrustApplicationAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public PatchTrustApplicationAttributes() { + } + + public PatchTrustApplicationAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchTrustApplicationAttributes patchTrustApplicationAttributes = (PatchTrustApplicationAttributes) o; + return Objects.equals(this.tags, patchTrustApplicationAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchTrustApplicationAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchTrustApplicationAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchTrustApplicationAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchTrustApplicationAttributes is not found in the empty JSON string", PatchTrustApplicationAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchTrustApplicationAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchTrustApplicationAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchTrustApplicationAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchTrustApplicationAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchTrustApplicationAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchTrustApplicationAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchTrustApplicationAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchTrustApplicationAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchTrustApplicationAttributes + * @throws IOException if the JSON string is invalid with respect to PatchTrustApplicationAttributes + */ + public static PatchTrustApplicationAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchTrustApplicationAttributes.class); + } + + /** + * Convert an instance of PatchTrustApplicationAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Payment.java b/src/main/java/org/openapitools/client/model/Payment.java new file mode 100644 index 00000000..c1a18561 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Payment.java @@ -0,0 +1,215 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Payment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Payment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public Payment() { + this.type = this.getClass().getSimpleName(); + } + + public Payment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Payment id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payment payment = (Payment) o; + return Objects.equals(this.type, payment.type) && + Objects.equals(this.id, payment.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Payment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Payment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Payment is not found in the empty JSON string", Payment.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "achPayment": + AchPayment.validateJsonElement(jsonElement); + break; + case "billPayment": + BillPayment.validateJsonElement(jsonElement); + break; + case "bookPayment": + BookPayment.validateJsonElement(jsonElement); + break; + case "wirePayment": + WirePayment.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Payment given an JSON string + * + * @param jsonString JSON string + * @return An instance of Payment + * @throws IOException if the JSON string is invalid with respect to Payment + */ + public static Payment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Payment.class); + } + + /** + * Convert an instance of Payment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaymentAdvanceTransaction.java b/src/main/java/org/openapitools/client/model/PaymentAdvanceTransaction.java new file mode 100644 index 00000000..1bbff376 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaymentAdvanceTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaymentAdvanceTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaymentAdvanceTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public PaymentAdvanceTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public PaymentAdvanceTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public PaymentAdvanceTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentAdvanceTransaction paymentAdvanceTransaction = (PaymentAdvanceTransaction) o; + return Objects.equals(this.attributes, paymentAdvanceTransaction.attributes) && + Objects.equals(this.relationships, paymentAdvanceTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentAdvanceTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentAdvanceTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentAdvanceTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentAdvanceTransaction is not found in the empty JSON string", PaymentAdvanceTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentAdvanceTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentAdvanceTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PaymentAdvanceTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentAdvanceTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentAdvanceTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentAdvanceTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentAdvanceTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentAdvanceTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentAdvanceTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentAdvanceTransaction + * @throws IOException if the JSON string is invalid with respect to PaymentAdvanceTransaction + */ + public static PaymentAdvanceTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentAdvanceTransaction.class); + } + + /** + * Convert an instance of PaymentAdvanceTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaymentRelationship.java b/src/main/java/org/openapitools/client/model/PaymentRelationship.java new file mode 100644 index 00000000..4947d423 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaymentRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PaymentRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaymentRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaymentRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private PaymentRelationshipData data; + + public PaymentRelationship() { + } + + public PaymentRelationship data(PaymentRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public PaymentRelationshipData getData() { + return data; + } + + + public void setData(PaymentRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentRelationship paymentRelationship = (PaymentRelationship) o; + return Objects.equals(this.data, paymentRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentRelationship is not found in the empty JSON string", PaymentRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PaymentRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PaymentRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentRelationship + * @throws IOException if the JSON string is invalid with respect to PaymentRelationship + */ + public static PaymentRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentRelationship.class); + } + + /** + * Convert an instance of PaymentRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaymentRelationshipData.java b/src/main/java/org/openapitools/client/model/PaymentRelationshipData.java new file mode 100644 index 00000000..6c6cc57d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaymentRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaymentRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaymentRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "payment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public PaymentRelationshipData() { + } + + public PaymentRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PaymentRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentRelationshipData paymentRelationshipData = (PaymentRelationshipData) o; + return Objects.equals(this.type, paymentRelationshipData.type) && + Objects.equals(this.id, paymentRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentRelationshipData is not found in the empty JSON string", PaymentRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PaymentRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentRelationshipData + * @throws IOException if the JSON string is invalid with respect to PaymentRelationshipData + */ + public static PaymentRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentRelationshipData.class); + } + + /** + * Convert an instance of PaymentRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaymentRelationships.java b/src/main/java/org/openapitools/client/model/PaymentRelationships.java new file mode 100644 index 00000000..cc03d5a3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaymentRelationships.java @@ -0,0 +1,479 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PaymentRelationshipsCustomers; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; + @SerializedName(SERIALIZED_NAME_CUSTOMERS) + private PaymentRelationshipsCustomers customers; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Relationship counterparty; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT = "counterpartyAccount"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT) + private Relationship counterpartyAccount; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + @SerializedName(SERIALIZED_NAME_TRANSACTION) + private Relationship transaction; + + public static final String SERIALIZED_NAME_RECURRING_PAYMENT = "recurringPayment"; + @SerializedName(SERIALIZED_NAME_RECURRING_PAYMENT) + private Relationship recurringPayment; + + public PaymentRelationships() { + } + + public PaymentRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + public PaymentRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + public PaymentRelationships customers(PaymentRelationshipsCustomers customers) { + + this.customers = customers; + return this; + } + + /** + * Get customers + * @return customers + **/ + @javax.annotation.Nullable + public PaymentRelationshipsCustomers getCustomers() { + return customers; + } + + + public void setCustomers(PaymentRelationshipsCustomers customers) { + this.customers = customers; + } + + + public PaymentRelationships counterparty(Relationship counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public Relationship getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Relationship counterparty) { + this.counterparty = counterparty; + } + + + public PaymentRelationships counterpartyAccount(Relationship counterpartyAccount) { + + this.counterpartyAccount = counterpartyAccount; + return this; + } + + /** + * Get counterpartyAccount + * @return counterpartyAccount + **/ + @javax.annotation.Nullable + public Relationship getCounterpartyAccount() { + return counterpartyAccount; + } + + + public void setCounterpartyAccount(Relationship counterpartyAccount) { + this.counterpartyAccount = counterpartyAccount; + } + + + public PaymentRelationships transaction(Relationship transaction) { + + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * @return transaction + **/ + @javax.annotation.Nullable + public Relationship getTransaction() { + return transaction; + } + + + public void setTransaction(Relationship transaction) { + this.transaction = transaction; + } + + + public PaymentRelationships recurringPayment(Relationship recurringPayment) { + + this.recurringPayment = recurringPayment; + return this; + } + + /** + * Get recurringPayment + * @return recurringPayment + **/ + @javax.annotation.Nullable + public Relationship getRecurringPayment() { + return recurringPayment; + } + + + public void setRecurringPayment(Relationship recurringPayment) { + this.recurringPayment = recurringPayment; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PaymentRelationships instance itself + */ + public PaymentRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentRelationships paymentRelationships = (PaymentRelationships) o; + return Objects.equals(this.account, paymentRelationships.account) && + Objects.equals(this.customer, paymentRelationships.customer) && + Objects.equals(this.customers, paymentRelationships.customers) && + Objects.equals(this.counterparty, paymentRelationships.counterparty) && + Objects.equals(this.counterpartyAccount, paymentRelationships.counterpartyAccount) && + Objects.equals(this.transaction, paymentRelationships.transaction) && + Objects.equals(this.recurringPayment, paymentRelationships.recurringPayment)&& + Objects.equals(this.additionalProperties, paymentRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer, customers, counterparty, counterpartyAccount, transaction, recurringPayment, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" counterpartyAccount: ").append(toIndentedString(counterpartyAccount)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" recurringPayment: ").append(toIndentedString(recurringPayment)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("customers"); + openapiFields.add("counterparty"); + openapiFields.add("counterpartyAccount"); + openapiFields.add("transaction"); + openapiFields.add("recurringPayment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentRelationships is not found in the empty JSON string", PaymentRelationships.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("account")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `customers` + if (jsonObj.get("customers") != null && !jsonObj.get("customers").isJsonNull()) { + PaymentRelationshipsCustomers.validateJsonElement(jsonObj.get("customers")); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("counterparty")); + } + // validate the optional field `counterpartyAccount` + if (jsonObj.get("counterpartyAccount") != null && !jsonObj.get("counterpartyAccount").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("counterpartyAccount")); + } + // validate the optional field `transaction` + if (jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("transaction")); + } + // validate the optional field `recurringPayment` + if (jsonObj.get("recurringPayment") != null && !jsonObj.get("recurringPayment").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("recurringPayment")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PaymentRelationships instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentRelationships + * @throws IOException if the JSON string is invalid with respect to PaymentRelationships + */ + public static PaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentRelationships.class); + } + + /** + * Convert an instance of PaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaymentRelationshipsCustomers.java b/src/main/java/org/openapitools/client/model/PaymentRelationshipsCustomers.java new file mode 100644 index 00000000..ba6fd5d8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaymentRelationshipsCustomers.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.PaymentRelationshipsCustomersDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaymentRelationshipsCustomers + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaymentRelationshipsCustomers { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public PaymentRelationshipsCustomers() { + } + + public PaymentRelationshipsCustomers data(List data) { + + this.data = data; + return this; + } + + public PaymentRelationshipsCustomers addDataItem(PaymentRelationshipsCustomersDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentRelationshipsCustomers paymentRelationshipsCustomers = (PaymentRelationshipsCustomers) o; + return Objects.equals(this.data, paymentRelationshipsCustomers.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentRelationshipsCustomers {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentRelationshipsCustomers + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentRelationshipsCustomers.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentRelationshipsCustomers is not found in the empty JSON string", PaymentRelationshipsCustomers.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentRelationshipsCustomers.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentRelationshipsCustomers` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + PaymentRelationshipsCustomersDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentRelationshipsCustomers.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentRelationshipsCustomers' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentRelationshipsCustomers.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentRelationshipsCustomers value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentRelationshipsCustomers read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentRelationshipsCustomers given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentRelationshipsCustomers + * @throws IOException if the JSON string is invalid with respect to PaymentRelationshipsCustomers + */ + public static PaymentRelationshipsCustomers fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentRelationshipsCustomers.class); + } + + /** + * Convert an instance of PaymentRelationshipsCustomers to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PaymentRelationshipsCustomersDataInner.java b/src/main/java/org/openapitools/client/model/PaymentRelationshipsCustomersDataInner.java new file mode 100644 index 00000000..820bd000 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PaymentRelationshipsCustomersDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PaymentRelationshipsCustomersDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PaymentRelationshipsCustomersDataInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "org"; + + public PaymentRelationshipsCustomersDataInner() { + } + + public PaymentRelationshipsCustomersDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public PaymentRelationshipsCustomersDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentRelationshipsCustomersDataInner paymentRelationshipsCustomersDataInner = (PaymentRelationshipsCustomersDataInner) o; + return Objects.equals(this.id, paymentRelationshipsCustomersDataInner.id) && + Objects.equals(this.type, paymentRelationshipsCustomersDataInner.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentRelationshipsCustomersDataInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentRelationshipsCustomersDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentRelationshipsCustomersDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentRelationshipsCustomersDataInner is not found in the empty JSON string", PaymentRelationshipsCustomersDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentRelationshipsCustomersDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentRelationshipsCustomersDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentRelationshipsCustomersDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentRelationshipsCustomersDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentRelationshipsCustomersDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentRelationshipsCustomersDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentRelationshipsCustomersDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentRelationshipsCustomersDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentRelationshipsCustomersDataInner + * @throws IOException if the JSON string is invalid with respect to PaymentRelationshipsCustomersDataInner + */ + public static PaymentRelationshipsCustomersDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentRelationshipsCustomersDataInner.class); + } + + /** + * Convert an instance of PaymentRelationshipsCustomersDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Phone.java b/src/main/java/org/openapitools/client/model/Phone.java new file mode 100644 index 00000000..0ef3048b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Phone.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Phone + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Phone { + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + private String countryCode; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + private String number; + + public Phone() { + } + + public Phone countryCode(String countryCode) { + + this.countryCode = countryCode; + return this; + } + + /** + * Get countryCode + * @return countryCode + **/ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + + public Phone number(String number) { + + this.number = number; + return this; + } + + /** + * Get number + * @return number + **/ + @javax.annotation.Nonnull + public String getNumber() { + return number; + } + + + public void setNumber(String number) { + this.number = number; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Phone phone = (Phone) o; + return Objects.equals(this.countryCode, phone.countryCode) && + Objects.equals(this.number, phone.number); + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Phone {\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("countryCode"); + openapiFields.add("number"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("number"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Phone + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Phone.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Phone is not found in the empty JSON string", Phone.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Phone.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Phone` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Phone.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Phone.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Phone' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Phone.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Phone value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Phone read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Phone given an JSON string + * + * @param jsonString JSON string + * @return An instance of Phone + * @throws IOException if the JSON string is invalid with respect to Phone + */ + public static Phone fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Phone.class); + } + + /** + * Convert an instance of Phone to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PhysicalCardStatus.java b/src/main/java/org/openapitools/client/model/PhysicalCardStatus.java new file mode 100644 index 00000000..3124ea84 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PhysicalCardStatus.java @@ -0,0 +1,86 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets physicalCardStatus + */ +@JsonAdapter(PhysicalCardStatus.Adapter.class) +public enum PhysicalCardStatus { + + ACTIVE("Active"), + + INACTIVE("Inactive"), + + STOLEN("Stolen"), + + LOST("Lost"), + + FROZEN("Frozen"), + + CLOSEDBYCUSTOMER("ClosedByCustomer"), + + UNKNOWN("Unknown"), + + SUSPECTEDFRAUD("SuspectedFraud"), + + ACTIVEFORONLINEUSE("ActiveForOnlineUse"); + + private String value; + + PhysicalCardStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PhysicalCardStatus fromValue(String value) { + for (PhysicalCardStatus b : PhysicalCardStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PhysicalCardStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PhysicalCardStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PhysicalCardStatus.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/PinStatus.java b/src/main/java/org/openapitools/client/model/PinStatus.java new file mode 100644 index 00000000..161525a6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PinStatus.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PinStatusAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PinStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PinStatus { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PinStatusAttributes attributes; + + public PinStatus() { + } + + public PinStatus type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public PinStatus attributes(PinStatusAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public PinStatusAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PinStatusAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PinStatus pinStatus = (PinStatus) o; + return Objects.equals(this.type, pinStatus.type) && + Objects.equals(this.attributes, pinStatus.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PinStatus {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PinStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PinStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PinStatus is not found in the empty JSON string", PinStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PinStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PinStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + PinStatusAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PinStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PinStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PinStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PinStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PinStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PinStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of PinStatus + * @throws IOException if the JSON string is invalid with respect to PinStatus + */ + public static PinStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PinStatus.class); + } + + /** + * Convert an instance of PinStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PinStatusAttributes.java b/src/main/java/org/openapitools/client/model/PinStatusAttributes.java new file mode 100644 index 00000000..caefc7b1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PinStatusAttributes.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PinStatusAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PinStatusAttributes { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public PinStatusAttributes() { + } + + public PinStatusAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PinStatusAttributes pinStatusAttributes = (PinStatusAttributes) o; + return Objects.equals(this.status, pinStatusAttributes.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PinStatusAttributes {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PinStatusAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PinStatusAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PinStatusAttributes is not found in the empty JSON string", PinStatusAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PinStatusAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PinStatusAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PinStatusAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PinStatusAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PinStatusAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PinStatusAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PinStatusAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PinStatusAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PinStatusAttributes + * @throws IOException if the JSON string is invalid with respect to PinStatusAttributes + */ + public static PinStatusAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PinStatusAttributes.class); + } + + /** + * Convert an instance of PinStatusAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PowerOfAttorneyAgent.java b/src/main/java/org/openapitools/client/model/PowerOfAttorneyAgent.java new file mode 100644 index 00000000..dc675208 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PowerOfAttorneyAgent.java @@ -0,0 +1,687 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PowerOfAttorneyAgent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PowerOfAttorneyAgent { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Object address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_MASKED_S_S_N = "maskedSSN"; + @SerializedName(SERIALIZED_NAME_MASKED_S_S_N) + private String maskedSSN; + + public static final String SERIALIZED_NAME_MASKED_PASSPORT = "maskedPassport"; + @SerializedName(SERIALIZED_NAME_MASKED_PASSPORT) + private String maskedPassport; + + public static final String SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR = "maskedMatriculaConsular"; + @SerializedName(SERIALIZED_NAME_MASKED_MATRICULA_CONSULAR) + private String maskedMatriculaConsular; + + public static final String SERIALIZED_NAME_ID_THEFT_SCORE = "idTheftScore"; + @SerializedName(SERIALIZED_NAME_ID_THEFT_SCORE) + private Integer idTheftScore; + + public PowerOfAttorneyAgent() { + } + + public PowerOfAttorneyAgent status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public PowerOfAttorneyAgent fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public PowerOfAttorneyAgent email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public PowerOfAttorneyAgent phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public PowerOfAttorneyAgent ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public PowerOfAttorneyAgent passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public PowerOfAttorneyAgent nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public PowerOfAttorneyAgent matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public PowerOfAttorneyAgent address(Object address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Object getAddress() { + return address; + } + + + public void setAddress(Object address) { + this.address = address; + } + + + public PowerOfAttorneyAgent dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public PowerOfAttorneyAgent evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public PowerOfAttorneyAgent evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public PowerOfAttorneyAgent addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public PowerOfAttorneyAgent maskedSSN(String maskedSSN) { + + this.maskedSSN = maskedSSN; + return this; + } + + /** + * Get maskedSSN + * @return maskedSSN + **/ + @javax.annotation.Nullable + public String getMaskedSSN() { + return maskedSSN; + } + + + public void setMaskedSSN(String maskedSSN) { + this.maskedSSN = maskedSSN; + } + + + public PowerOfAttorneyAgent maskedPassport(String maskedPassport) { + + this.maskedPassport = maskedPassport; + return this; + } + + /** + * Get maskedPassport + * @return maskedPassport + **/ + @javax.annotation.Nullable + public String getMaskedPassport() { + return maskedPassport; + } + + + public void setMaskedPassport(String maskedPassport) { + this.maskedPassport = maskedPassport; + } + + + public PowerOfAttorneyAgent maskedMatriculaConsular(String maskedMatriculaConsular) { + + this.maskedMatriculaConsular = maskedMatriculaConsular; + return this; + } + + /** + * Get maskedMatriculaConsular + * @return maskedMatriculaConsular + **/ + @javax.annotation.Nullable + public String getMaskedMatriculaConsular() { + return maskedMatriculaConsular; + } + + + public void setMaskedMatriculaConsular(String maskedMatriculaConsular) { + this.maskedMatriculaConsular = maskedMatriculaConsular; + } + + + public PowerOfAttorneyAgent idTheftScore(Integer idTheftScore) { + + this.idTheftScore = idTheftScore; + return this; + } + + /** + * Get idTheftScore + * @return idTheftScore + **/ + @javax.annotation.Nullable + public Integer getIdTheftScore() { + return idTheftScore; + } + + + public void setIdTheftScore(Integer idTheftScore) { + this.idTheftScore = idTheftScore; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PowerOfAttorneyAgent powerOfAttorneyAgent = (PowerOfAttorneyAgent) o; + return Objects.equals(this.status, powerOfAttorneyAgent.status) && + Objects.equals(this.fullName, powerOfAttorneyAgent.fullName) && + Objects.equals(this.email, powerOfAttorneyAgent.email) && + Objects.equals(this.phone, powerOfAttorneyAgent.phone) && + Objects.equals(this.ssn, powerOfAttorneyAgent.ssn) && + Objects.equals(this.passport, powerOfAttorneyAgent.passport) && + Objects.equals(this.nationality, powerOfAttorneyAgent.nationality) && + Objects.equals(this.matriculaConsular, powerOfAttorneyAgent.matriculaConsular) && + Objects.equals(this.address, powerOfAttorneyAgent.address) && + Objects.equals(this.dateOfBirth, powerOfAttorneyAgent.dateOfBirth) && + Objects.equals(this.evaluationId, powerOfAttorneyAgent.evaluationId) && + Objects.equals(this.evaluationFlags, powerOfAttorneyAgent.evaluationFlags) && + Objects.equals(this.maskedSSN, powerOfAttorneyAgent.maskedSSN) && + Objects.equals(this.maskedPassport, powerOfAttorneyAgent.maskedPassport) && + Objects.equals(this.maskedMatriculaConsular, powerOfAttorneyAgent.maskedMatriculaConsular) && + Objects.equals(this.idTheftScore, powerOfAttorneyAgent.idTheftScore); + } + + @Override + public int hashCode() { + return Objects.hash(status, fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth, evaluationId, evaluationFlags, maskedSSN, maskedPassport, maskedMatriculaConsular, idTheftScore); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PowerOfAttorneyAgent {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" maskedSSN: ").append(toIndentedString(maskedSSN)).append("\n"); + sb.append(" maskedPassport: ").append(toIndentedString(maskedPassport)).append("\n"); + sb.append(" maskedMatriculaConsular: ").append(toIndentedString(maskedMatriculaConsular)).append("\n"); + sb.append(" idTheftScore: ").append(toIndentedString(idTheftScore)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + openapiFields.add("evaluationId"); + openapiFields.add("evaluationFlags"); + openapiFields.add("maskedSSN"); + openapiFields.add("maskedPassport"); + openapiFields.add("maskedMatriculaConsular"); + openapiFields.add("idTheftScore"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("fullName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PowerOfAttorneyAgent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PowerOfAttorneyAgent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PowerOfAttorneyAgent is not found in the empty JSON string", PowerOfAttorneyAgent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PowerOfAttorneyAgent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PowerOfAttorneyAgent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PowerOfAttorneyAgent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + if ((jsonObj.get("maskedSSN") != null && !jsonObj.get("maskedSSN").isJsonNull()) && !jsonObj.get("maskedSSN").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedSSN` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedSSN").toString())); + } + if ((jsonObj.get("maskedPassport") != null && !jsonObj.get("maskedPassport").isJsonNull()) && !jsonObj.get("maskedPassport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedPassport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedPassport").toString())); + } + if ((jsonObj.get("maskedMatriculaConsular") != null && !jsonObj.get("maskedMatriculaConsular").isJsonNull()) && !jsonObj.get("maskedMatriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `maskedMatriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("maskedMatriculaConsular").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PowerOfAttorneyAgent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PowerOfAttorneyAgent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PowerOfAttorneyAgent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PowerOfAttorneyAgent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PowerOfAttorneyAgent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PowerOfAttorneyAgent given an JSON string + * + * @param jsonString JSON string + * @return An instance of PowerOfAttorneyAgent + * @throws IOException if the JSON string is invalid with respect to PowerOfAttorneyAgent + */ + public static PowerOfAttorneyAgent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PowerOfAttorneyAgent.class); + } + + /** + * Convert an instance of PowerOfAttorneyAgent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Prefilled.java b/src/main/java/org/openapitools/client/model/Prefilled.java new file mode 100644 index 00000000..776638e2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Prefilled.java @@ -0,0 +1,884 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.Contact; +import org.openapitools.client.model.CreateBeneficialOwner; +import org.openapitools.client.model.CreateOfficer; +import org.openapitools.client.model.EntityType; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Industry; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Prefilled + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Prefilled { + /** + * Gets or Sets applicationType + */ + @JsonAdapter(ApplicationTypeEnum.Adapter.class) + public enum ApplicationTypeEnum { + INDIVIDUAL("Individual"), + + BUSINESS("Business"), + + SOLEPROPRIETORSHIP("SoleProprietorship"); + + private String value; + + ApplicationTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ApplicationTypeEnum fromValue(String value) { + for (ApplicationTypeEnum b : ApplicationTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ApplicationTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ApplicationTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ApplicationTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_APPLICATION_TYPE = "applicationType"; + @SerializedName(SERIALIZED_NAME_APPLICATION_TYPE) + private ApplicationTypeEnum applicationType; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_ENTITY_TYPE = "entityType"; + @SerializedName(SERIALIZED_NAME_ENTITY_TYPE) + private EntityType entityType; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private Contact contact; + + public static final String SERIALIZED_NAME_OFFICER = "officer"; + @SerializedName(SERIALIZED_NAME_OFFICER) + private CreateOfficer officer; + + public static final String SERIALIZED_NAME_BENEFICIAL_OWNERS = "beneficialOwners"; + @SerializedName(SERIALIZED_NAME_BENEFICIAL_OWNERS) + private List beneficialOwners; + + public static final String SERIALIZED_NAME_WEBSITE = "website"; + @SerializedName(SERIALIZED_NAME_WEBSITE) + private String website; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public static final String SERIALIZED_NAME_INDUSTRY = "industry"; + @SerializedName(SERIALIZED_NAME_INDUSTRY) + private Industry industry; + + public Prefilled() { + } + + public Prefilled applicationType(ApplicationTypeEnum applicationType) { + + this.applicationType = applicationType; + return this; + } + + /** + * Get applicationType + * @return applicationType + **/ + @javax.annotation.Nullable + public ApplicationTypeEnum getApplicationType() { + return applicationType; + } + + + public void setApplicationType(ApplicationTypeEnum applicationType) { + this.applicationType = applicationType; + } + + + public Prefilled fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Prefilled ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public Prefilled passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public Prefilled nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public Prefilled dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nullable + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + public Prefilled email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Prefilled name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Prefilled stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nullable + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public Prefilled entityType(EntityType entityType) { + + this.entityType = entityType; + return this; + } + + /** + * Get entityType + * @return entityType + **/ + @javax.annotation.Nullable + public EntityType getEntityType() { + return entityType; + } + + + public void setEntityType(EntityType entityType) { + this.entityType = entityType; + } + + + public Prefilled contact(Contact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nullable + public Contact getContact() { + return contact; + } + + + public void setContact(Contact contact) { + this.contact = contact; + } + + + public Prefilled officer(CreateOfficer officer) { + + this.officer = officer; + return this; + } + + /** + * Get officer + * @return officer + **/ + @javax.annotation.Nullable + public CreateOfficer getOfficer() { + return officer; + } + + + public void setOfficer(CreateOfficer officer) { + this.officer = officer; + } + + + public Prefilled beneficialOwners(List beneficialOwners) { + + this.beneficialOwners = beneficialOwners; + return this; + } + + public Prefilled addBeneficialOwnersItem(CreateBeneficialOwner beneficialOwnersItem) { + if (this.beneficialOwners == null) { + this.beneficialOwners = new ArrayList<>(); + } + this.beneficialOwners.add(beneficialOwnersItem); + return this; + } + + /** + * Get beneficialOwners + * @return beneficialOwners + **/ + @javax.annotation.Nullable + public List getBeneficialOwners() { + return beneficialOwners; + } + + + public void setBeneficialOwners(List beneficialOwners) { + this.beneficialOwners = beneficialOwners; + } + + + public Prefilled website(String website) { + + this.website = website; + return this; + } + + /** + * Get website + * @return website + **/ + @javax.annotation.Nullable + public String getWebsite() { + return website; + } + + + public void setWebsite(String website) { + this.website = website; + } + + + public Prefilled phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public Prefilled address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public Prefilled dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public Prefilled ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public Prefilled jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + public Prefilled industry(Industry industry) { + + this.industry = industry; + return this; + } + + /** + * Get industry + * @return industry + **/ + @javax.annotation.Nullable + public Industry getIndustry() { + return industry; + } + + + public void setIndustry(Industry industry) { + this.industry = industry; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Prefilled prefilled = (Prefilled) o; + return Objects.equals(this.applicationType, prefilled.applicationType) && + Objects.equals(this.fullName, prefilled.fullName) && + Objects.equals(this.ssn, prefilled.ssn) && + Objects.equals(this.passport, prefilled.passport) && + Objects.equals(this.nationality, prefilled.nationality) && + Objects.equals(this.dateOfBirth, prefilled.dateOfBirth) && + Objects.equals(this.email, prefilled.email) && + Objects.equals(this.name, prefilled.name) && + Objects.equals(this.stateOfIncorporation, prefilled.stateOfIncorporation) && + Objects.equals(this.entityType, prefilled.entityType) && + Objects.equals(this.contact, prefilled.contact) && + Objects.equals(this.officer, prefilled.officer) && + Objects.equals(this.beneficialOwners, prefilled.beneficialOwners) && + Objects.equals(this.website, prefilled.website) && + Objects.equals(this.phone, prefilled.phone) && + Objects.equals(this.address, prefilled.address) && + Objects.equals(this.dba, prefilled.dba) && + Objects.equals(this.ein, prefilled.ein) && + Objects.equals(this.jwtSubject, prefilled.jwtSubject) && + Objects.equals(this.industry, prefilled.industry); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(applicationType, fullName, ssn, passport, nationality, dateOfBirth, email, name, stateOfIncorporation, entityType, contact, officer, beneficialOwners, website, phone, address, dba, ein, jwtSubject, industry); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Prefilled {\n"); + sb.append(" applicationType: ").append(toIndentedString(applicationType)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" officer: ").append(toIndentedString(officer)).append("\n"); + sb.append(" beneficialOwners: ").append(toIndentedString(beneficialOwners)).append("\n"); + sb.append(" website: ").append(toIndentedString(website)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append(" industry: ").append(toIndentedString(industry)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicationType"); + openapiFields.add("fullName"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("dateOfBirth"); + openapiFields.add("email"); + openapiFields.add("name"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("entityType"); + openapiFields.add("contact"); + openapiFields.add("officer"); + openapiFields.add("beneficialOwners"); + openapiFields.add("website"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("jwtSubject"); + openapiFields.add("industry"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Prefilled + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Prefilled.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Prefilled is not found in the empty JSON string", Prefilled.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Prefilled.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Prefilled` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("applicationType") != null && !jsonObj.get("applicationType").isJsonNull()) && !jsonObj.get("applicationType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationType").toString())); + } + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("stateOfIncorporation") != null && !jsonObj.get("stateOfIncorporation").isJsonNull()) && !jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + Contact.validateJsonElement(jsonObj.get("contact")); + } + // validate the optional field `officer` + if (jsonObj.get("officer") != null && !jsonObj.get("officer").isJsonNull()) { + CreateOfficer.validateJsonElement(jsonObj.get("officer")); + } + if (jsonObj.get("beneficialOwners") != null && !jsonObj.get("beneficialOwners").isJsonNull()) { + JsonArray jsonArraybeneficialOwners = jsonObj.getAsJsonArray("beneficialOwners"); + if (jsonArraybeneficialOwners != null) { + // ensure the json data is an array + if (!jsonObj.get("beneficialOwners").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficialOwners` to be an array in the JSON string but got `%s`", jsonObj.get("beneficialOwners").toString())); + } + + // validate the optional field `beneficialOwners` (array) + for (int i = 0; i < jsonArraybeneficialOwners.size(); i++) { + CreateBeneficialOwner.validateJsonElement(jsonArraybeneficialOwners.get(i)); + }; + } + } + if ((jsonObj.get("website") != null && !jsonObj.get("website").isJsonNull()) && !jsonObj.get("website").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `website` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Prefilled.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Prefilled' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Prefilled.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Prefilled value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Prefilled read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Prefilled given an JSON string + * + * @param jsonString JSON string + * @return An instance of Prefilled + * @throws IOException if the JSON string is invalid with respect to Prefilled + */ + public static Prefilled fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Prefilled.class); + } + + /** + * Convert an instance of Prefilled to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PurchaseAuthorizationRequest.java b/src/main/java/org/openapitools/client/model/PurchaseAuthorizationRequest.java new file mode 100644 index 00000000..f041f0dd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PurchaseAuthorizationRequest.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequest; +import org.openapitools.client.model.AuthorizationRequestRelationships; +import org.openapitools.client.model.PurchaseAuthorizationRequestAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PurchaseAuthorizationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PurchaseAuthorizationRequest extends AuthorizationRequest { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PurchaseAuthorizationRequestAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private AuthorizationRequestRelationships relationships; + + public PurchaseAuthorizationRequest() { + this.type = this.getClass().getSimpleName(); + } + + public PurchaseAuthorizationRequest attributes(PurchaseAuthorizationRequestAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public PurchaseAuthorizationRequestAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PurchaseAuthorizationRequestAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public PurchaseAuthorizationRequest relationships(AuthorizationRequestRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public AuthorizationRequestRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(AuthorizationRequestRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PurchaseAuthorizationRequest purchaseAuthorizationRequest = (PurchaseAuthorizationRequest) o; + return Objects.equals(this.attributes, purchaseAuthorizationRequest.attributes) && + Objects.equals(this.relationships, purchaseAuthorizationRequest.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PurchaseAuthorizationRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PurchaseAuthorizationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PurchaseAuthorizationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PurchaseAuthorizationRequest is not found in the empty JSON string", PurchaseAuthorizationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PurchaseAuthorizationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PurchaseAuthorizationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PurchaseAuthorizationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PurchaseAuthorizationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PurchaseAuthorizationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PurchaseAuthorizationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PurchaseAuthorizationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PurchaseAuthorizationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PurchaseAuthorizationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PurchaseAuthorizationRequest + * @throws IOException if the JSON string is invalid with respect to PurchaseAuthorizationRequest + */ + public static PurchaseAuthorizationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PurchaseAuthorizationRequest.class); + } + + /** + * Convert an instance of PurchaseAuthorizationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PurchaseAuthorizationRequestAllOfAttributes.java b/src/main/java/org/openapitools/client/model/PurchaseAuthorizationRequestAllOfAttributes.java new file mode 100644 index 00000000..d0adaa5b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PurchaseAuthorizationRequestAllOfAttributes.java @@ -0,0 +1,695 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.CardVerificationData; +import org.openapitools.client.model.HealthcareAmounts; +import org.openapitools.client.model.Merchant; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PurchaseAuthorizationRequestAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PurchaseAuthorizationRequestAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_PARTIAL_APPROVAL_ALLOWED = "partialApprovalAllowed"; + @SerializedName(SERIALIZED_NAME_PARTIAL_APPROVAL_ALLOWED) + private Boolean partialApprovalAllowed; + + public static final String SERIALIZED_NAME_APPROVED_AMOUNT = "approvedAmount"; + @SerializedName(SERIALIZED_NAME_APPROVED_AMOUNT) + private Integer approvedAmount; + + public static final String SERIALIZED_NAME_DECLINE_REASON = "declineReason"; + @SerializedName(SERIALIZED_NAME_DECLINE_REASON) + private String declineReason; + + public static final String SERIALIZED_NAME_MERCHANT = "merchant"; + @SerializedName(SERIALIZED_NAME_MERCHANT) + private Merchant merchant; + + public static final String SERIALIZED_NAME_RECURRING = "recurring"; + @SerializedName(SERIALIZED_NAME_RECURRING) + private Boolean recurring; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_HEALTHCARE_AMOUNTS = "healthcareAmounts"; + @SerializedName(SERIALIZED_NAME_HEALTHCARE_AMOUNTS) + private HealthcareAmounts healthcareAmounts; + + public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod"; + @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD) + private String paymentMethod; + + public static final String SERIALIZED_NAME_DIGITAL_WALLET = "digitalWallet"; + @SerializedName(SERIALIZED_NAME_DIGITAL_WALLET) + private String digitalWallet; + + public static final String SERIALIZED_NAME_CARD_VERIFICATION_DATA = "cardVerificationData"; + @SerializedName(SERIALIZED_NAME_CARD_VERIFICATION_DATA) + private CardVerificationData cardVerificationData; + + public static final String SERIALIZED_NAME_ECOMMERCE = "ecommerce"; + @SerializedName(SERIALIZED_NAME_ECOMMERCE) + private Boolean ecommerce; + + public static final String SERIALIZED_NAME_CARD_PRESENT = "cardPresent"; + @SerializedName(SERIALIZED_NAME_CARD_PRESENT) + private Boolean cardPresent; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public static final String SERIALIZED_NAME_CASH_WITHDRAWAL_AMOUNT = "cashWithdrawalAmount"; + @SerializedName(SERIALIZED_NAME_CASH_WITHDRAWAL_AMOUNT) + private Integer cashWithdrawalAmount; + + public PurchaseAuthorizationRequestAllOfAttributes() { + } + + public PurchaseAuthorizationRequestAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public PurchaseAuthorizationRequestAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public PurchaseAuthorizationRequestAllOfAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public PurchaseAuthorizationRequestAllOfAttributes partialApprovalAllowed(Boolean partialApprovalAllowed) { + + this.partialApprovalAllowed = partialApprovalAllowed; + return this; + } + + /** + * Get partialApprovalAllowed + * @return partialApprovalAllowed + **/ + @javax.annotation.Nonnull + public Boolean getPartialApprovalAllowed() { + return partialApprovalAllowed; + } + + + public void setPartialApprovalAllowed(Boolean partialApprovalAllowed) { + this.partialApprovalAllowed = partialApprovalAllowed; + } + + + public PurchaseAuthorizationRequestAllOfAttributes approvedAmount(Integer approvedAmount) { + + this.approvedAmount = approvedAmount; + return this; + } + + /** + * Get approvedAmount + * @return approvedAmount + **/ + @javax.annotation.Nullable + public Integer getApprovedAmount() { + return approvedAmount; + } + + + public void setApprovedAmount(Integer approvedAmount) { + this.approvedAmount = approvedAmount; + } + + + public PurchaseAuthorizationRequestAllOfAttributes declineReason(String declineReason) { + + this.declineReason = declineReason; + return this; + } + + /** + * Get declineReason + * @return declineReason + **/ + @javax.annotation.Nullable + public String getDeclineReason() { + return declineReason; + } + + + public void setDeclineReason(String declineReason) { + this.declineReason = declineReason; + } + + + public PurchaseAuthorizationRequestAllOfAttributes merchant(Merchant merchant) { + + this.merchant = merchant; + return this; + } + + /** + * Get merchant + * @return merchant + **/ + @javax.annotation.Nonnull + public Merchant getMerchant() { + return merchant; + } + + + public void setMerchant(Merchant merchant) { + this.merchant = merchant; + } + + + public PurchaseAuthorizationRequestAllOfAttributes recurring(Boolean recurring) { + + this.recurring = recurring; + return this; + } + + /** + * Get recurring + * @return recurring + **/ + @javax.annotation.Nonnull + public Boolean getRecurring() { + return recurring; + } + + + public void setRecurring(Boolean recurring) { + this.recurring = recurring; + } + + + public PurchaseAuthorizationRequestAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PurchaseAuthorizationRequestAllOfAttributes healthcareAmounts(HealthcareAmounts healthcareAmounts) { + + this.healthcareAmounts = healthcareAmounts; + return this; + } + + /** + * Get healthcareAmounts + * @return healthcareAmounts + **/ + @javax.annotation.Nullable + public HealthcareAmounts getHealthcareAmounts() { + return healthcareAmounts; + } + + + public void setHealthcareAmounts(HealthcareAmounts healthcareAmounts) { + this.healthcareAmounts = healthcareAmounts; + } + + + public PurchaseAuthorizationRequestAllOfAttributes paymentMethod(String paymentMethod) { + + this.paymentMethod = paymentMethod; + return this; + } + + /** + * Get paymentMethod + * @return paymentMethod + **/ + @javax.annotation.Nullable + public String getPaymentMethod() { + return paymentMethod; + } + + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + + public PurchaseAuthorizationRequestAllOfAttributes digitalWallet(String digitalWallet) { + + this.digitalWallet = digitalWallet; + return this; + } + + /** + * Get digitalWallet + * @return digitalWallet + **/ + @javax.annotation.Nullable + public String getDigitalWallet() { + return digitalWallet; + } + + + public void setDigitalWallet(String digitalWallet) { + this.digitalWallet = digitalWallet; + } + + + public PurchaseAuthorizationRequestAllOfAttributes cardVerificationData(CardVerificationData cardVerificationData) { + + this.cardVerificationData = cardVerificationData; + return this; + } + + /** + * Get cardVerificationData + * @return cardVerificationData + **/ + @javax.annotation.Nullable + public CardVerificationData getCardVerificationData() { + return cardVerificationData; + } + + + public void setCardVerificationData(CardVerificationData cardVerificationData) { + this.cardVerificationData = cardVerificationData; + } + + + public PurchaseAuthorizationRequestAllOfAttributes ecommerce(Boolean ecommerce) { + + this.ecommerce = ecommerce; + return this; + } + + /** + * Get ecommerce + * @return ecommerce + **/ + @javax.annotation.Nullable + public Boolean getEcommerce() { + return ecommerce; + } + + + public void setEcommerce(Boolean ecommerce) { + this.ecommerce = ecommerce; + } + + + public PurchaseAuthorizationRequestAllOfAttributes cardPresent(Boolean cardPresent) { + + this.cardPresent = cardPresent; + return this; + } + + /** + * Get cardPresent + * @return cardPresent + **/ + @javax.annotation.Nullable + public Boolean getCardPresent() { + return cardPresent; + } + + + public void setCardPresent(Boolean cardPresent) { + this.cardPresent = cardPresent; + } + + + public PurchaseAuthorizationRequestAllOfAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + public PurchaseAuthorizationRequestAllOfAttributes cashWithdrawalAmount(Integer cashWithdrawalAmount) { + + this.cashWithdrawalAmount = cashWithdrawalAmount; + return this; + } + + /** + * Get cashWithdrawalAmount + * @return cashWithdrawalAmount + **/ + @javax.annotation.Nullable + public Integer getCashWithdrawalAmount() { + return cashWithdrawalAmount; + } + + + public void setCashWithdrawalAmount(Integer cashWithdrawalAmount) { + this.cashWithdrawalAmount = cashWithdrawalAmount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PurchaseAuthorizationRequestAllOfAttributes purchaseAuthorizationRequestAllOfAttributes = (PurchaseAuthorizationRequestAllOfAttributes) o; + return Objects.equals(this.createdAt, purchaseAuthorizationRequestAllOfAttributes.createdAt) && + Objects.equals(this.amount, purchaseAuthorizationRequestAllOfAttributes.amount) && + Objects.equals(this.status, purchaseAuthorizationRequestAllOfAttributes.status) && + Objects.equals(this.partialApprovalAllowed, purchaseAuthorizationRequestAllOfAttributes.partialApprovalAllowed) && + Objects.equals(this.approvedAmount, purchaseAuthorizationRequestAllOfAttributes.approvedAmount) && + Objects.equals(this.declineReason, purchaseAuthorizationRequestAllOfAttributes.declineReason) && + Objects.equals(this.merchant, purchaseAuthorizationRequestAllOfAttributes.merchant) && + Objects.equals(this.recurring, purchaseAuthorizationRequestAllOfAttributes.recurring) && + Objects.equals(this.tags, purchaseAuthorizationRequestAllOfAttributes.tags) && + Objects.equals(this.healthcareAmounts, purchaseAuthorizationRequestAllOfAttributes.healthcareAmounts) && + Objects.equals(this.paymentMethod, purchaseAuthorizationRequestAllOfAttributes.paymentMethod) && + Objects.equals(this.digitalWallet, purchaseAuthorizationRequestAllOfAttributes.digitalWallet) && + Objects.equals(this.cardVerificationData, purchaseAuthorizationRequestAllOfAttributes.cardVerificationData) && + Objects.equals(this.ecommerce, purchaseAuthorizationRequestAllOfAttributes.ecommerce) && + Objects.equals(this.cardPresent, purchaseAuthorizationRequestAllOfAttributes.cardPresent) && + Objects.equals(this.cardNetwork, purchaseAuthorizationRequestAllOfAttributes.cardNetwork) && + Objects.equals(this.cashWithdrawalAmount, purchaseAuthorizationRequestAllOfAttributes.cashWithdrawalAmount); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, status, partialApprovalAllowed, approvedAmount, declineReason, merchant, recurring, tags, healthcareAmounts, paymentMethod, digitalWallet, cardVerificationData, ecommerce, cardPresent, cardNetwork, cashWithdrawalAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PurchaseAuthorizationRequestAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" partialApprovalAllowed: ").append(toIndentedString(partialApprovalAllowed)).append("\n"); + sb.append(" approvedAmount: ").append(toIndentedString(approvedAmount)).append("\n"); + sb.append(" declineReason: ").append(toIndentedString(declineReason)).append("\n"); + sb.append(" merchant: ").append(toIndentedString(merchant)).append("\n"); + sb.append(" recurring: ").append(toIndentedString(recurring)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" healthcareAmounts: ").append(toIndentedString(healthcareAmounts)).append("\n"); + sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); + sb.append(" digitalWallet: ").append(toIndentedString(digitalWallet)).append("\n"); + sb.append(" cardVerificationData: ").append(toIndentedString(cardVerificationData)).append("\n"); + sb.append(" ecommerce: ").append(toIndentedString(ecommerce)).append("\n"); + sb.append(" cardPresent: ").append(toIndentedString(cardPresent)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append(" cashWithdrawalAmount: ").append(toIndentedString(cashWithdrawalAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("status"); + openapiFields.add("partialApprovalAllowed"); + openapiFields.add("approvedAmount"); + openapiFields.add("declineReason"); + openapiFields.add("merchant"); + openapiFields.add("recurring"); + openapiFields.add("tags"); + openapiFields.add("healthcareAmounts"); + openapiFields.add("paymentMethod"); + openapiFields.add("digitalWallet"); + openapiFields.add("cardVerificationData"); + openapiFields.add("ecommerce"); + openapiFields.add("cardPresent"); + openapiFields.add("cardNetwork"); + openapiFields.add("cashWithdrawalAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("partialApprovalAllowed"); + openapiRequiredFields.add("merchant"); + openapiRequiredFields.add("recurring"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PurchaseAuthorizationRequestAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PurchaseAuthorizationRequestAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PurchaseAuthorizationRequestAllOfAttributes is not found in the empty JSON string", PurchaseAuthorizationRequestAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PurchaseAuthorizationRequestAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PurchaseAuthorizationRequestAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PurchaseAuthorizationRequestAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("declineReason") != null && !jsonObj.get("declineReason").isJsonNull()) && !jsonObj.get("declineReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `declineReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("declineReason").toString())); + } + // validate the required field `merchant` + Merchant.validateJsonElement(jsonObj.get("merchant")); + // validate the optional field `healthcareAmounts` + if (jsonObj.get("healthcareAmounts") != null && !jsonObj.get("healthcareAmounts").isJsonNull()) { + HealthcareAmounts.validateJsonElement(jsonObj.get("healthcareAmounts")); + } + if ((jsonObj.get("paymentMethod") != null && !jsonObj.get("paymentMethod").isJsonNull()) && !jsonObj.get("paymentMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethod").toString())); + } + if ((jsonObj.get("digitalWallet") != null && !jsonObj.get("digitalWallet").isJsonNull()) && !jsonObj.get("digitalWallet").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digitalWallet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digitalWallet").toString())); + } + // validate the optional field `cardVerificationData` + if (jsonObj.get("cardVerificationData") != null && !jsonObj.get("cardVerificationData").isJsonNull()) { + CardVerificationData.validateJsonElement(jsonObj.get("cardVerificationData")); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PurchaseAuthorizationRequestAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PurchaseAuthorizationRequestAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PurchaseAuthorizationRequestAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PurchaseAuthorizationRequestAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PurchaseAuthorizationRequestAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PurchaseAuthorizationRequestAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PurchaseAuthorizationRequestAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to PurchaseAuthorizationRequestAllOfAttributes + */ + public static PurchaseAuthorizationRequestAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PurchaseAuthorizationRequestAllOfAttributes.class); + } + + /** + * Convert an instance of PurchaseAuthorizationRequestAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PurchaseTransaction.java b/src/main/java/org/openapitools/client/model/PurchaseTransaction.java new file mode 100644 index 00000000..e1ffacca --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PurchaseTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PurchaseTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PurchaseTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PurchaseTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private PurchaseTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public PurchaseTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public PurchaseTransaction attributes(PurchaseTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public PurchaseTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(PurchaseTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public PurchaseTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PurchaseTransaction purchaseTransaction = (PurchaseTransaction) o; + return Objects.equals(this.attributes, purchaseTransaction.attributes) && + Objects.equals(this.relationships, purchaseTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PurchaseTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PurchaseTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PurchaseTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PurchaseTransaction is not found in the empty JSON string", PurchaseTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PurchaseTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PurchaseTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PurchaseTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PurchaseTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PurchaseTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PurchaseTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PurchaseTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PurchaseTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PurchaseTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of PurchaseTransaction + * @throws IOException if the JSON string is invalid with respect to PurchaseTransaction + */ + public static PurchaseTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PurchaseTransaction.class); + } + + /** + * Convert an instance of PurchaseTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/PurchaseTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/PurchaseTransactionAllOfAttributes.java new file mode 100644 index 00000000..9e6e929d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/PurchaseTransactionAllOfAttributes.java @@ -0,0 +1,823 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.CardVerificationData; +import org.openapitools.client.model.Coordinates; +import org.openapitools.client.model.Merchant; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PurchaseTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PurchaseTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_CARD_LAST4_DIGITS = "cardLast4Digits"; + @SerializedName(SERIALIZED_NAME_CARD_LAST4_DIGITS) + private String cardLast4Digits; + + public static final String SERIALIZED_NAME_MERCHANT = "merchant"; + @SerializedName(SERIALIZED_NAME_MERCHANT) + private Merchant merchant; + + public static final String SERIALIZED_NAME_COORDINATES = "coordinates"; + @SerializedName(SERIALIZED_NAME_COORDINATES) + private Coordinates coordinates; + + public static final String SERIALIZED_NAME_RECURRING = "recurring"; + @SerializedName(SERIALIZED_NAME_RECURRING) + private Boolean recurring; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_NETWORK_TRANSACTION_ID = "networkTransactionId"; + @SerializedName(SERIALIZED_NAME_NETWORK_TRANSACTION_ID) + private String networkTransactionId; + + public static final String SERIALIZED_NAME_INTERCHANGE = "interchange"; + @SerializedName(SERIALIZED_NAME_INTERCHANGE) + private String interchange; + + public static final String SERIALIZED_NAME_ECOMMERCE = "ecommerce"; + @SerializedName(SERIALIZED_NAME_ECOMMERCE) + private Boolean ecommerce; + + public static final String SERIALIZED_NAME_CARD_PRESENT = "cardPresent"; + @SerializedName(SERIALIZED_NAME_CARD_PRESENT) + private Boolean cardPresent; + + public static final String SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE = "internationalServiceFee"; + @SerializedName(SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE) + private Integer internationalServiceFee; + + public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod"; + @SerializedName(SERIALIZED_NAME_PAYMENT_METHOD) + private String paymentMethod; + + public static final String SERIALIZED_NAME_DIGITAL_WALLET = "digitalWallet"; + @SerializedName(SERIALIZED_NAME_DIGITAL_WALLET) + private String digitalWallet; + + public static final String SERIALIZED_NAME_CARD_VERIFICATION_DATA = "cardVerificationData"; + @SerializedName(SERIALIZED_NAME_CARD_VERIFICATION_DATA) + private CardVerificationData cardVerificationData; + + public static final String SERIALIZED_NAME_CARD_NETWORK = "cardNetwork"; + @SerializedName(SERIALIZED_NAME_CARD_NETWORK) + private String cardNetwork; + + public PurchaseTransactionAllOfAttributes() { + } + + public PurchaseTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public PurchaseTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public PurchaseTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public PurchaseTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public PurchaseTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public PurchaseTransactionAllOfAttributes cardLast4Digits(String cardLast4Digits) { + + this.cardLast4Digits = cardLast4Digits; + return this; + } + + /** + * Get cardLast4Digits + * @return cardLast4Digits + **/ + @javax.annotation.Nonnull + public String getCardLast4Digits() { + return cardLast4Digits; + } + + + public void setCardLast4Digits(String cardLast4Digits) { + this.cardLast4Digits = cardLast4Digits; + } + + + public PurchaseTransactionAllOfAttributes merchant(Merchant merchant) { + + this.merchant = merchant; + return this; + } + + /** + * Get merchant + * @return merchant + **/ + @javax.annotation.Nonnull + public Merchant getMerchant() { + return merchant; + } + + + public void setMerchant(Merchant merchant) { + this.merchant = merchant; + } + + + public PurchaseTransactionAllOfAttributes coordinates(Coordinates coordinates) { + + this.coordinates = coordinates; + return this; + } + + /** + * Get coordinates + * @return coordinates + **/ + @javax.annotation.Nullable + public Coordinates getCoordinates() { + return coordinates; + } + + + public void setCoordinates(Coordinates coordinates) { + this.coordinates = coordinates; + } + + + public PurchaseTransactionAllOfAttributes recurring(Boolean recurring) { + + this.recurring = recurring; + return this; + } + + /** + * Get recurring + * @return recurring + **/ + @javax.annotation.Nonnull + public Boolean getRecurring() { + return recurring; + } + + + public void setRecurring(Boolean recurring) { + this.recurring = recurring; + } + + + public PurchaseTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public PurchaseTransactionAllOfAttributes networkTransactionId(String networkTransactionId) { + + this.networkTransactionId = networkTransactionId; + return this; + } + + /** + * Get networkTransactionId + * @return networkTransactionId + **/ + @javax.annotation.Nullable + public String getNetworkTransactionId() { + return networkTransactionId; + } + + + public void setNetworkTransactionId(String networkTransactionId) { + this.networkTransactionId = networkTransactionId; + } + + + public PurchaseTransactionAllOfAttributes interchange(String interchange) { + + this.interchange = interchange; + return this; + } + + /** + * Get interchange + * @return interchange + **/ + @javax.annotation.Nullable + public String getInterchange() { + return interchange; + } + + + public void setInterchange(String interchange) { + this.interchange = interchange; + } + + + public PurchaseTransactionAllOfAttributes ecommerce(Boolean ecommerce) { + + this.ecommerce = ecommerce; + return this; + } + + /** + * Get ecommerce + * @return ecommerce + **/ + @javax.annotation.Nonnull + public Boolean getEcommerce() { + return ecommerce; + } + + + public void setEcommerce(Boolean ecommerce) { + this.ecommerce = ecommerce; + } + + + public PurchaseTransactionAllOfAttributes cardPresent(Boolean cardPresent) { + + this.cardPresent = cardPresent; + return this; + } + + /** + * Get cardPresent + * @return cardPresent + **/ + @javax.annotation.Nonnull + public Boolean getCardPresent() { + return cardPresent; + } + + + public void setCardPresent(Boolean cardPresent) { + this.cardPresent = cardPresent; + } + + + public PurchaseTransactionAllOfAttributes internationalServiceFee(Integer internationalServiceFee) { + + this.internationalServiceFee = internationalServiceFee; + return this; + } + + /** + * Get internationalServiceFee + * @return internationalServiceFee + **/ + @javax.annotation.Nullable + public Integer getInternationalServiceFee() { + return internationalServiceFee; + } + + + public void setInternationalServiceFee(Integer internationalServiceFee) { + this.internationalServiceFee = internationalServiceFee; + } + + + public PurchaseTransactionAllOfAttributes paymentMethod(String paymentMethod) { + + this.paymentMethod = paymentMethod; + return this; + } + + /** + * Get paymentMethod + * @return paymentMethod + **/ + @javax.annotation.Nullable + public String getPaymentMethod() { + return paymentMethod; + } + + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + + public PurchaseTransactionAllOfAttributes digitalWallet(String digitalWallet) { + + this.digitalWallet = digitalWallet; + return this; + } + + /** + * Get digitalWallet + * @return digitalWallet + **/ + @javax.annotation.Nullable + public String getDigitalWallet() { + return digitalWallet; + } + + + public void setDigitalWallet(String digitalWallet) { + this.digitalWallet = digitalWallet; + } + + + public PurchaseTransactionAllOfAttributes cardVerificationData(CardVerificationData cardVerificationData) { + + this.cardVerificationData = cardVerificationData; + return this; + } + + /** + * Get cardVerificationData + * @return cardVerificationData + **/ + @javax.annotation.Nullable + public CardVerificationData getCardVerificationData() { + return cardVerificationData; + } + + + public void setCardVerificationData(CardVerificationData cardVerificationData) { + this.cardVerificationData = cardVerificationData; + } + + + public PurchaseTransactionAllOfAttributes cardNetwork(String cardNetwork) { + + this.cardNetwork = cardNetwork; + return this; + } + + /** + * Get cardNetwork + * @return cardNetwork + **/ + @javax.annotation.Nullable + public String getCardNetwork() { + return cardNetwork; + } + + + public void setCardNetwork(String cardNetwork) { + this.cardNetwork = cardNetwork; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PurchaseTransactionAllOfAttributes purchaseTransactionAllOfAttributes = (PurchaseTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, purchaseTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, purchaseTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, purchaseTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, purchaseTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, purchaseTransactionAllOfAttributes.summary) && + Objects.equals(this.cardLast4Digits, purchaseTransactionAllOfAttributes.cardLast4Digits) && + Objects.equals(this.merchant, purchaseTransactionAllOfAttributes.merchant) && + Objects.equals(this.coordinates, purchaseTransactionAllOfAttributes.coordinates) && + Objects.equals(this.recurring, purchaseTransactionAllOfAttributes.recurring) && + Objects.equals(this.tags, purchaseTransactionAllOfAttributes.tags) && + Objects.equals(this.networkTransactionId, purchaseTransactionAllOfAttributes.networkTransactionId) && + Objects.equals(this.interchange, purchaseTransactionAllOfAttributes.interchange) && + Objects.equals(this.ecommerce, purchaseTransactionAllOfAttributes.ecommerce) && + Objects.equals(this.cardPresent, purchaseTransactionAllOfAttributes.cardPresent) && + Objects.equals(this.internationalServiceFee, purchaseTransactionAllOfAttributes.internationalServiceFee) && + Objects.equals(this.paymentMethod, purchaseTransactionAllOfAttributes.paymentMethod) && + Objects.equals(this.digitalWallet, purchaseTransactionAllOfAttributes.digitalWallet) && + Objects.equals(this.cardVerificationData, purchaseTransactionAllOfAttributes.cardVerificationData) && + Objects.equals(this.cardNetwork, purchaseTransactionAllOfAttributes.cardNetwork); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, cardLast4Digits, merchant, coordinates, recurring, tags, networkTransactionId, interchange, ecommerce, cardPresent, internationalServiceFee, paymentMethod, digitalWallet, cardVerificationData, cardNetwork); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PurchaseTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" cardLast4Digits: ").append(toIndentedString(cardLast4Digits)).append("\n"); + sb.append(" merchant: ").append(toIndentedString(merchant)).append("\n"); + sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append(" recurring: ").append(toIndentedString(recurring)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" networkTransactionId: ").append(toIndentedString(networkTransactionId)).append("\n"); + sb.append(" interchange: ").append(toIndentedString(interchange)).append("\n"); + sb.append(" ecommerce: ").append(toIndentedString(ecommerce)).append("\n"); + sb.append(" cardPresent: ").append(toIndentedString(cardPresent)).append("\n"); + sb.append(" internationalServiceFee: ").append(toIndentedString(internationalServiceFee)).append("\n"); + sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); + sb.append(" digitalWallet: ").append(toIndentedString(digitalWallet)).append("\n"); + sb.append(" cardVerificationData: ").append(toIndentedString(cardVerificationData)).append("\n"); + sb.append(" cardNetwork: ").append(toIndentedString(cardNetwork)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("cardLast4Digits"); + openapiFields.add("merchant"); + openapiFields.add("coordinates"); + openapiFields.add("recurring"); + openapiFields.add("tags"); + openapiFields.add("networkTransactionId"); + openapiFields.add("interchange"); + openapiFields.add("ecommerce"); + openapiFields.add("cardPresent"); + openapiFields.add("internationalServiceFee"); + openapiFields.add("paymentMethod"); + openapiFields.add("digitalWallet"); + openapiFields.add("cardVerificationData"); + openapiFields.add("cardNetwork"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("cardLast4Digits"); + openapiRequiredFields.add("merchant"); + openapiRequiredFields.add("recurring"); + openapiRequiredFields.add("ecommerce"); + openapiRequiredFields.add("cardPresent"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PurchaseTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PurchaseTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PurchaseTransactionAllOfAttributes is not found in the empty JSON string", PurchaseTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PurchaseTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PurchaseTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PurchaseTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("cardLast4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardLast4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardLast4Digits").toString())); + } + // validate the required field `merchant` + Merchant.validateJsonElement(jsonObj.get("merchant")); + // validate the optional field `coordinates` + if (jsonObj.get("coordinates") != null && !jsonObj.get("coordinates").isJsonNull()) { + Coordinates.validateJsonElement(jsonObj.get("coordinates")); + } + if ((jsonObj.get("networkTransactionId") != null && !jsonObj.get("networkTransactionId").isJsonNull()) && !jsonObj.get("networkTransactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `networkTransactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("networkTransactionId").toString())); + } + if ((jsonObj.get("interchange") != null && !jsonObj.get("interchange").isJsonNull()) && !jsonObj.get("interchange").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `interchange` to be a primitive type in the JSON string but got `%s`", jsonObj.get("interchange").toString())); + } + if ((jsonObj.get("paymentMethod") != null && !jsonObj.get("paymentMethod").isJsonNull()) && !jsonObj.get("paymentMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentMethod").toString())); + } + if ((jsonObj.get("digitalWallet") != null && !jsonObj.get("digitalWallet").isJsonNull()) && !jsonObj.get("digitalWallet").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digitalWallet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digitalWallet").toString())); + } + // validate the optional field `cardVerificationData` + if (jsonObj.get("cardVerificationData") != null && !jsonObj.get("cardVerificationData").isJsonNull()) { + CardVerificationData.validateJsonElement(jsonObj.get("cardVerificationData")); + } + if ((jsonObj.get("cardNetwork") != null && !jsonObj.get("cardNetwork").isJsonNull()) && !jsonObj.get("cardNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardNetwork` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PurchaseTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PurchaseTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PurchaseTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PurchaseTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PurchaseTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PurchaseTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of PurchaseTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to PurchaseTransactionAllOfAttributes + */ + public static PurchaseTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PurchaseTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of PurchaseTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedAchTransaction.java b/src/main/java/org/openapitools/client/model/ReceivedAchTransaction.java new file mode 100644 index 00000000..bb16aa16 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedAchTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedAchTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedAchTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedAchTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReceivedAchTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReceivedAchTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReceivedAchTransaction attributes(ReceivedAchTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReceivedAchTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReceivedAchTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReceivedAchTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedAchTransaction receivedAchTransaction = (ReceivedAchTransaction) o; + return Objects.equals(this.attributes, receivedAchTransaction.attributes) && + Objects.equals(this.relationships, receivedAchTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedAchTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedAchTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedAchTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedAchTransaction is not found in the empty JSON string", ReceivedAchTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedAchTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedAchTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedAchTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedAchTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedAchTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedAchTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedAchTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedAchTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedAchTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedAchTransaction + * @throws IOException if the JSON string is invalid with respect to ReceivedAchTransaction + */ + public static ReceivedAchTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedAchTransaction.class); + } + + /** + * Convert an instance of ReceivedAchTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedAchTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReceivedAchTransactionAllOfAttributes.java new file mode 100644 index 00000000..9ebefed5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedAchTransactionAllOfAttributes.java @@ -0,0 +1,631 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedAchTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedAchTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + private String companyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_NAME = "counterpartyName"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_NAME) + private String counterpartyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER = "counterpartyRoutingNumber"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER) + private String counterpartyRoutingNumber; + + public static final String SERIALIZED_NAME_TRACE_NUMBER = "traceNumber"; + @SerializedName(SERIALIZED_NAME_TRACE_NUMBER) + private String traceNumber; + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private String secCode; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReceivedAchTransactionAllOfAttributes() { + } + + public ReceivedAchTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReceivedAchTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReceivedAchTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReceivedAchTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReceivedAchTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReceivedAchTransactionAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public ReceivedAchTransactionAllOfAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public ReceivedAchTransactionAllOfAttributes companyName(String companyName) { + + this.companyName = companyName; + return this; + } + + /** + * Get companyName + * @return companyName + **/ + @javax.annotation.Nonnull + public String getCompanyName() { + return companyName; + } + + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + + public ReceivedAchTransactionAllOfAttributes counterpartyName(String counterpartyName) { + + this.counterpartyName = counterpartyName; + return this; + } + + /** + * Get counterpartyName + * @return counterpartyName + **/ + @javax.annotation.Nullable + public String getCounterpartyName() { + return counterpartyName; + } + + + public void setCounterpartyName(String counterpartyName) { + this.counterpartyName = counterpartyName; + } + + + public ReceivedAchTransactionAllOfAttributes counterpartyRoutingNumber(String counterpartyRoutingNumber) { + + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + return this; + } + + /** + * Get counterpartyRoutingNumber + * @return counterpartyRoutingNumber + **/ + @javax.annotation.Nonnull + public String getCounterpartyRoutingNumber() { + return counterpartyRoutingNumber; + } + + + public void setCounterpartyRoutingNumber(String counterpartyRoutingNumber) { + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + } + + + public ReceivedAchTransactionAllOfAttributes traceNumber(String traceNumber) { + + this.traceNumber = traceNumber; + return this; + } + + /** + * Get traceNumber + * @return traceNumber + **/ + @javax.annotation.Nullable + public String getTraceNumber() { + return traceNumber; + } + + + public void setTraceNumber(String traceNumber) { + this.traceNumber = traceNumber; + } + + + public ReceivedAchTransactionAllOfAttributes secCode(String secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nullable + public String getSecCode() { + return secCode; + } + + + public void setSecCode(String secCode) { + this.secCode = secCode; + } + + + public ReceivedAchTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedAchTransactionAllOfAttributes receivedAchTransactionAllOfAttributes = (ReceivedAchTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, receivedAchTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, receivedAchTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, receivedAchTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, receivedAchTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, receivedAchTransactionAllOfAttributes.summary) && + Objects.equals(this.description, receivedAchTransactionAllOfAttributes.description) && + Objects.equals(this.addenda, receivedAchTransactionAllOfAttributes.addenda) && + Objects.equals(this.companyName, receivedAchTransactionAllOfAttributes.companyName) && + Objects.equals(this.counterpartyName, receivedAchTransactionAllOfAttributes.counterpartyName) && + Objects.equals(this.counterpartyRoutingNumber, receivedAchTransactionAllOfAttributes.counterpartyRoutingNumber) && + Objects.equals(this.traceNumber, receivedAchTransactionAllOfAttributes.traceNumber) && + Objects.equals(this.secCode, receivedAchTransactionAllOfAttributes.secCode) && + Objects.equals(this.tags, receivedAchTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, description, addenda, companyName, counterpartyName, counterpartyRoutingNumber, traceNumber, secCode, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedAchTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" counterpartyName: ").append(toIndentedString(counterpartyName)).append("\n"); + sb.append(" counterpartyRoutingNumber: ").append(toIndentedString(counterpartyRoutingNumber)).append("\n"); + sb.append(" traceNumber: ").append(toIndentedString(traceNumber)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("companyName"); + openapiFields.add("counterpartyName"); + openapiFields.add("counterpartyRoutingNumber"); + openapiFields.add("traceNumber"); + openapiFields.add("secCode"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("companyName"); + openapiRequiredFields.add("counterpartyRoutingNumber"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedAchTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedAchTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedAchTransactionAllOfAttributes is not found in the empty JSON string", ReceivedAchTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedAchTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedAchTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedAchTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if ((jsonObj.get("counterpartyName") != null && !jsonObj.get("counterpartyName").isJsonNull()) && !jsonObj.get("counterpartyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyName").toString())); + } + if (!jsonObj.get("counterpartyRoutingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyRoutingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyRoutingNumber").toString())); + } + if ((jsonObj.get("traceNumber") != null && !jsonObj.get("traceNumber").isJsonNull()) && !jsonObj.get("traceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `traceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceNumber").toString())); + } + if ((jsonObj.get("secCode") != null && !jsonObj.get("secCode").isJsonNull()) && !jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedAchTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedAchTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedAchTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedAchTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedAchTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedAchTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedAchTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReceivedAchTransactionAllOfAttributes + */ + public static ReceivedAchTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedAchTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReceivedAchTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPayment.java b/src/main/java/org/openapitools/client/model/ReceivedPayment.java new file mode 100644 index 00000000..d8ae617b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPayment.java @@ -0,0 +1,301 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentAttributes; +import org.openapitools.client.model.ReceivedPaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReceivedPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private ReceivedPaymentRelationships relationships; + + public ReceivedPayment() { + } + + public ReceivedPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ReceivedPayment id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ReceivedPayment attributes(ReceivedPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public ReceivedPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReceivedPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public ReceivedPayment relationships(ReceivedPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(ReceivedPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPayment receivedPayment = (ReceivedPayment) o; + return Objects.equals(this.type, receivedPayment.type) && + Objects.equals(this.id, receivedPayment.id) && + Objects.equals(this.attributes, receivedPayment.attributes) && + Objects.equals(this.relationships, receivedPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPayment is not found in the empty JSON string", ReceivedPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + ReceivedPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPayment + * @throws IOException if the JSON string is invalid with respect to ReceivedPayment + */ + public static ReceivedPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPayment.class); + } + + /** + * Convert an instance of ReceivedPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentAttributes.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentAttributes.java new file mode 100644 index 00000000..e9bb912a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentAttributes.java @@ -0,0 +1,804 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + ADVANCED("Advanced"), + + COMPLETED("Completed"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_COMPLETION_DATE = "completionDate"; + @SerializedName(SERIALIZED_NAME_COMPLETION_DATE) + private String completionDate; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + DEBIT("Debit"), + + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_WAS_ADVANCED = "wasAdvanced"; + @SerializedName(SERIALIZED_NAME_WAS_ADVANCED) + private Boolean wasAdvanced; + + public static final String SERIALIZED_NAME_IS_ADVANCEABLE = "isAdvanceable"; + @SerializedName(SERIALIZED_NAME_IS_ADVANCEABLE) + private Boolean isAdvanceable; + + public static final String SERIALIZED_NAME_IS_ADVACEABLE = "isAdvaceable"; + @SerializedName(SERIALIZED_NAME_IS_ADVACEABLE) + private Boolean isAdvaceable; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + private String companyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER = "counterpartyRoutingNumber"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER) + private String counterpartyRoutingNumber; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_TRACE_NUMBER = "traceNumber"; + @SerializedName(SERIALIZED_NAME_TRACE_NUMBER) + private String traceNumber; + + public static final String SERIALIZED_NAME_SEC_CODE = "secCode"; + @SerializedName(SERIALIZED_NAME_SEC_CODE) + private String secCode; + + public static final String SERIALIZED_NAME_RETURN_REASON = "returnReason"; + @SerializedName(SERIALIZED_NAME_RETURN_REASON) + private String returnReason; + + public static final String SERIALIZED_NAME_RECEIVING_ENTITY_NAME = "receivingEntityName"; + @SerializedName(SERIALIZED_NAME_RECEIVING_ENTITY_NAME) + private String receivingEntityName; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReceivedPaymentAttributes() { + } + + public ReceivedPaymentAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReceivedPaymentAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public ReceivedPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReceivedPaymentAttributes completionDate(String completionDate) { + + this.completionDate = completionDate; + return this; + } + + /** + * Get completionDate + * @return completionDate + **/ + @javax.annotation.Nonnull + public String getCompletionDate() { + return completionDate; + } + + + public void setCompletionDate(String completionDate) { + this.completionDate = completionDate; + } + + + public ReceivedPaymentAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReceivedPaymentAttributes wasAdvanced(Boolean wasAdvanced) { + + this.wasAdvanced = wasAdvanced; + return this; + } + + /** + * Get wasAdvanced + * @return wasAdvanced + **/ + @javax.annotation.Nonnull + public Boolean getWasAdvanced() { + return wasAdvanced; + } + + + public void setWasAdvanced(Boolean wasAdvanced) { + this.wasAdvanced = wasAdvanced; + } + + + public ReceivedPaymentAttributes isAdvanceable(Boolean isAdvanceable) { + + this.isAdvanceable = isAdvanceable; + return this; + } + + /** + * Get isAdvanceable + * @return isAdvanceable + **/ + @javax.annotation.Nullable + public Boolean getIsAdvanceable() { + return isAdvanceable; + } + + + public void setIsAdvanceable(Boolean isAdvanceable) { + this.isAdvanceable = isAdvanceable; + } + + + public ReceivedPaymentAttributes isAdvaceable(Boolean isAdvaceable) { + + this.isAdvaceable = isAdvaceable; + return this; + } + + /** + * Get isAdvaceable + * @return isAdvaceable + **/ + @javax.annotation.Nullable + public Boolean getIsAdvaceable() { + return isAdvaceable; + } + + + public void setIsAdvaceable(Boolean isAdvaceable) { + this.isAdvaceable = isAdvaceable; + } + + + public ReceivedPaymentAttributes companyName(String companyName) { + + this.companyName = companyName; + return this; + } + + /** + * Get companyName + * @return companyName + **/ + @javax.annotation.Nonnull + public String getCompanyName() { + return companyName; + } + + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + + public ReceivedPaymentAttributes counterpartyRoutingNumber(String counterpartyRoutingNumber) { + + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + return this; + } + + /** + * Get counterpartyRoutingNumber + * @return counterpartyRoutingNumber + **/ + @javax.annotation.Nonnull + public String getCounterpartyRoutingNumber() { + return counterpartyRoutingNumber; + } + + + public void setCounterpartyRoutingNumber(String counterpartyRoutingNumber) { + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + } + + + public ReceivedPaymentAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public ReceivedPaymentAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public ReceivedPaymentAttributes traceNumber(String traceNumber) { + + this.traceNumber = traceNumber; + return this; + } + + /** + * Get traceNumber + * @return traceNumber + **/ + @javax.annotation.Nonnull + public String getTraceNumber() { + return traceNumber; + } + + + public void setTraceNumber(String traceNumber) { + this.traceNumber = traceNumber; + } + + + public ReceivedPaymentAttributes secCode(String secCode) { + + this.secCode = secCode; + return this; + } + + /** + * Get secCode + * @return secCode + **/ + @javax.annotation.Nonnull + public String getSecCode() { + return secCode; + } + + + public void setSecCode(String secCode) { + this.secCode = secCode; + } + + + public ReceivedPaymentAttributes returnReason(String returnReason) { + + this.returnReason = returnReason; + return this; + } + + /** + * Get returnReason + * @return returnReason + **/ + @javax.annotation.Nullable + public String getReturnReason() { + return returnReason; + } + + + public void setReturnReason(String returnReason) { + this.returnReason = returnReason; + } + + + public ReceivedPaymentAttributes receivingEntityName(String receivingEntityName) { + + this.receivingEntityName = receivingEntityName; + return this; + } + + /** + * Get receivingEntityName + * @return receivingEntityName + **/ + @javax.annotation.Nullable + public String getReceivingEntityName() { + return receivingEntityName; + } + + + public void setReceivingEntityName(String receivingEntityName) { + this.receivingEntityName = receivingEntityName; + } + + + public ReceivedPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentAttributes receivedPaymentAttributes = (ReceivedPaymentAttributes) o; + return Objects.equals(this.createdAt, receivedPaymentAttributes.createdAt) && + Objects.equals(this.status, receivedPaymentAttributes.status) && + Objects.equals(this.amount, receivedPaymentAttributes.amount) && + Objects.equals(this.completionDate, receivedPaymentAttributes.completionDate) && + Objects.equals(this.direction, receivedPaymentAttributes.direction) && + Objects.equals(this.wasAdvanced, receivedPaymentAttributes.wasAdvanced) && + Objects.equals(this.isAdvanceable, receivedPaymentAttributes.isAdvanceable) && + Objects.equals(this.isAdvaceable, receivedPaymentAttributes.isAdvaceable) && + Objects.equals(this.companyName, receivedPaymentAttributes.companyName) && + Objects.equals(this.counterpartyRoutingNumber, receivedPaymentAttributes.counterpartyRoutingNumber) && + Objects.equals(this.description, receivedPaymentAttributes.description) && + Objects.equals(this.addenda, receivedPaymentAttributes.addenda) && + Objects.equals(this.traceNumber, receivedPaymentAttributes.traceNumber) && + Objects.equals(this.secCode, receivedPaymentAttributes.secCode) && + Objects.equals(this.returnReason, receivedPaymentAttributes.returnReason) && + Objects.equals(this.receivingEntityName, receivedPaymentAttributes.receivingEntityName) && + Objects.equals(this.tags, receivedPaymentAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, status, amount, completionDate, direction, wasAdvanced, isAdvanceable, isAdvaceable, companyName, counterpartyRoutingNumber, description, addenda, traceNumber, secCode, returnReason, receivingEntityName, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" completionDate: ").append(toIndentedString(completionDate)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" wasAdvanced: ").append(toIndentedString(wasAdvanced)).append("\n"); + sb.append(" isAdvanceable: ").append(toIndentedString(isAdvanceable)).append("\n"); + sb.append(" isAdvaceable: ").append(toIndentedString(isAdvaceable)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" counterpartyRoutingNumber: ").append(toIndentedString(counterpartyRoutingNumber)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" traceNumber: ").append(toIndentedString(traceNumber)).append("\n"); + sb.append(" secCode: ").append(toIndentedString(secCode)).append("\n"); + sb.append(" returnReason: ").append(toIndentedString(returnReason)).append("\n"); + sb.append(" receivingEntityName: ").append(toIndentedString(receivingEntityName)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("status"); + openapiFields.add("amount"); + openapiFields.add("completionDate"); + openapiFields.add("direction"); + openapiFields.add("wasAdvanced"); + openapiFields.add("isAdvanceable"); + openapiFields.add("isAdvaceable"); + openapiFields.add("companyName"); + openapiFields.add("counterpartyRoutingNumber"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("traceNumber"); + openapiFields.add("secCode"); + openapiFields.add("returnReason"); + openapiFields.add("receivingEntityName"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("completionDate"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("wasAdvanced"); + openapiRequiredFields.add("companyName"); + openapiRequiredFields.add("counterpartyRoutingNumber"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("traceNumber"); + openapiRequiredFields.add("secCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentAttributes is not found in the empty JSON string", ReceivedPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (!jsonObj.get("completionDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `completionDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("completionDate").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if (!jsonObj.get("counterpartyRoutingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyRoutingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyRoutingNumber").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("traceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `traceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceNumber").toString())); + } + if (!jsonObj.get("secCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secCode").toString())); + } + if ((jsonObj.get("returnReason") != null && !jsonObj.get("returnReason").isJsonNull()) && !jsonObj.get("returnReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `returnReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("returnReason").toString())); + } + if ((jsonObj.get("receivingEntityName") != null && !jsonObj.get("receivingEntityName").isJsonNull()) && !jsonObj.get("receivingEntityName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `receivingEntityName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("receivingEntityName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentAttributes + */ + public static ReceivedPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentAttributes.class); + } + + /** + * Convert an instance of ReceivedPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationship.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationship.java new file mode 100644 index 00000000..41507f4c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipData data; + + public ReceivedPaymentRelationship() { + } + + public ReceivedPaymentRelationship data(ReceivedPaymentRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationship receivedPaymentRelationship = (ReceivedPaymentRelationship) o; + return Objects.equals(this.data, receivedPaymentRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationship is not found in the empty JSON string", ReceivedPaymentRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationship + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationship + */ + public static ReceivedPaymentRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationship.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipData.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipData.java new file mode 100644 index 00000000..66113940 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "receivedPayment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ReceivedPaymentRelationshipData() { + } + + public ReceivedPaymentRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ReceivedPaymentRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationshipData receivedPaymentRelationshipData = (ReceivedPaymentRelationshipData) o; + return Objects.equals(this.type, receivedPaymentRelationshipData.type) && + Objects.equals(this.id, receivedPaymentRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationshipData is not found in the empty JSON string", ReceivedPaymentRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationshipData + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationshipData + */ + public static ReceivedPaymentRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationshipData.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationships.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationships.java new file mode 100644 index 00000000..d382d747 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationships.java @@ -0,0 +1,421 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransaction; +import org.openapitools.client.model.RelationshipsAccount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RelationshipsAccount account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_RECEIVE_PAYMENT_TRANSACTION = "receivePaymentTransaction"; + @SerializedName(SERIALIZED_NAME_RECEIVE_PAYMENT_TRANSACTION) + private ReceivedPaymentRelationshipsReceivePaymentTransaction receivePaymentTransaction; + + public static final String SERIALIZED_NAME_PAYMENT_ADVANCE_TRANSACTION = "paymentAdvanceTransaction"; + @SerializedName(SERIALIZED_NAME_PAYMENT_ADVANCE_TRANSACTION) + private ReceivedPaymentRelationshipsReceivePaymentTransaction paymentAdvanceTransaction; + + public static final String SERIALIZED_NAME_REPAY_PAYMENT_ADVANCE_TRANSACTION = "repayPaymentAdvanceTransaction"; + @SerializedName(SERIALIZED_NAME_REPAY_PAYMENT_ADVANCE_TRANSACTION) + private ReceivedPaymentRelationshipsReceivePaymentTransaction repayPaymentAdvanceTransaction; + + public ReceivedPaymentRelationships() { + } + + public ReceivedPaymentRelationships account(RelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public RelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RelationshipsAccount account) { + this.account = account; + } + + + public ReceivedPaymentRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + public ReceivedPaymentRelationships receivePaymentTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction receivePaymentTransaction) { + + this.receivePaymentTransaction = receivePaymentTransaction; + return this; + } + + /** + * Get receivePaymentTransaction + * @return receivePaymentTransaction + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsReceivePaymentTransaction getReceivePaymentTransaction() { + return receivePaymentTransaction; + } + + + public void setReceivePaymentTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction receivePaymentTransaction) { + this.receivePaymentTransaction = receivePaymentTransaction; + } + + + public ReceivedPaymentRelationships paymentAdvanceTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction paymentAdvanceTransaction) { + + this.paymentAdvanceTransaction = paymentAdvanceTransaction; + return this; + } + + /** + * Get paymentAdvanceTransaction + * @return paymentAdvanceTransaction + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsReceivePaymentTransaction getPaymentAdvanceTransaction() { + return paymentAdvanceTransaction; + } + + + public void setPaymentAdvanceTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction paymentAdvanceTransaction) { + this.paymentAdvanceTransaction = paymentAdvanceTransaction; + } + + + public ReceivedPaymentRelationships repayPaymentAdvanceTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction repayPaymentAdvanceTransaction) { + + this.repayPaymentAdvanceTransaction = repayPaymentAdvanceTransaction; + return this; + } + + /** + * Get repayPaymentAdvanceTransaction + * @return repayPaymentAdvanceTransaction + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsReceivePaymentTransaction getRepayPaymentAdvanceTransaction() { + return repayPaymentAdvanceTransaction; + } + + + public void setRepayPaymentAdvanceTransaction(ReceivedPaymentRelationshipsReceivePaymentTransaction repayPaymentAdvanceTransaction) { + this.repayPaymentAdvanceTransaction = repayPaymentAdvanceTransaction; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReceivedPaymentRelationships instance itself + */ + public ReceivedPaymentRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationships receivedPaymentRelationships = (ReceivedPaymentRelationships) o; + return Objects.equals(this.account, receivedPaymentRelationships.account) && + Objects.equals(this.customer, receivedPaymentRelationships.customer) && + Objects.equals(this.receivePaymentTransaction, receivedPaymentRelationships.receivePaymentTransaction) && + Objects.equals(this.paymentAdvanceTransaction, receivedPaymentRelationships.paymentAdvanceTransaction) && + Objects.equals(this.repayPaymentAdvanceTransaction, receivedPaymentRelationships.repayPaymentAdvanceTransaction)&& + Objects.equals(this.additionalProperties, receivedPaymentRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer, receivePaymentTransaction, paymentAdvanceTransaction, repayPaymentAdvanceTransaction, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" receivePaymentTransaction: ").append(toIndentedString(receivePaymentTransaction)).append("\n"); + sb.append(" paymentAdvanceTransaction: ").append(toIndentedString(paymentAdvanceTransaction)).append("\n"); + sb.append(" repayPaymentAdvanceTransaction: ").append(toIndentedString(repayPaymentAdvanceTransaction)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("receivePaymentTransaction"); + openapiFields.add("paymentAdvanceTransaction"); + openapiFields.add("repayPaymentAdvanceTransaction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationships is not found in the empty JSON string", ReceivedPaymentRelationships.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + RelationshipsAccount.validateJsonElement(jsonObj.get("account")); + // validate the required field `customer` + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + // validate the optional field `receivePaymentTransaction` + if (jsonObj.get("receivePaymentTransaction") != null && !jsonObj.get("receivePaymentTransaction").isJsonNull()) { + ReceivedPaymentRelationshipsReceivePaymentTransaction.validateJsonElement(jsonObj.get("receivePaymentTransaction")); + } + // validate the optional field `paymentAdvanceTransaction` + if (jsonObj.get("paymentAdvanceTransaction") != null && !jsonObj.get("paymentAdvanceTransaction").isJsonNull()) { + ReceivedPaymentRelationshipsReceivePaymentTransaction.validateJsonElement(jsonObj.get("paymentAdvanceTransaction")); + } + // validate the optional field `repayPaymentAdvanceTransaction` + if (jsonObj.get("repayPaymentAdvanceTransaction") != null && !jsonObj.get("repayPaymentAdvanceTransaction").isJsonNull()) { + ReceivedPaymentRelationshipsReceivePaymentTransaction.validateJsonElement(jsonObj.get("repayPaymentAdvanceTransaction")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReceivedPaymentRelationships instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationships + */ + public static ReceivedPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationships.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsCustomer.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsCustomer.java new file mode 100644 index 00000000..b915fc09 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsCustomer.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationshipsCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationshipsCustomer { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsCustomerData data; + + public ReceivedPaymentRelationshipsCustomer() { + } + + public ReceivedPaymentRelationshipsCustomer data(ReceivedPaymentRelationshipsCustomerData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsCustomerData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsCustomerData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationshipsCustomer receivedPaymentRelationshipsCustomer = (ReceivedPaymentRelationshipsCustomer) o; + return Objects.equals(this.data, receivedPaymentRelationshipsCustomer.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationshipsCustomer {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationshipsCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationshipsCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationshipsCustomer is not found in the empty JSON string", ReceivedPaymentRelationshipsCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentRelationshipsCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentRelationshipsCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationshipsCustomer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsCustomerData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationshipsCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationshipsCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationshipsCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationshipsCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationshipsCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationshipsCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationshipsCustomer + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationshipsCustomer + */ + public static ReceivedPaymentRelationshipsCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationshipsCustomer.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationshipsCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsCustomerData.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsCustomerData.java new file mode 100644 index 00000000..d4a272a1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsCustomerData.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationshipsCustomerData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationshipsCustomerData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUSINESSCUSTOMER("businessCustomer"), + + INDIVIDUALCUSTOMER("individualCustomer"), + + CUSTOMER("customer"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ReceivedPaymentRelationshipsCustomerData() { + } + + public ReceivedPaymentRelationshipsCustomerData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public ReceivedPaymentRelationshipsCustomerData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationshipsCustomerData receivedPaymentRelationshipsCustomerData = (ReceivedPaymentRelationshipsCustomerData) o; + return Objects.equals(this.type, receivedPaymentRelationshipsCustomerData.type) && + Objects.equals(this.id, receivedPaymentRelationshipsCustomerData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationshipsCustomerData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationshipsCustomerData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationshipsCustomerData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationshipsCustomerData is not found in the empty JSON string", ReceivedPaymentRelationshipsCustomerData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentRelationshipsCustomerData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentRelationshipsCustomerData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationshipsCustomerData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationshipsCustomerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationshipsCustomerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationshipsCustomerData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationshipsCustomerData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationshipsCustomerData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationshipsCustomerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationshipsCustomerData + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationshipsCustomerData + */ + public static ReceivedPaymentRelationshipsCustomerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationshipsCustomerData.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationshipsCustomerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsReceivePaymentTransaction.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsReceivePaymentTransaction.java new file mode 100644 index 00000000..12fc8f85 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsReceivePaymentTransaction.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransactionData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationshipsReceivePaymentTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationshipsReceivePaymentTransaction { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsReceivePaymentTransactionData data; + + public ReceivedPaymentRelationshipsReceivePaymentTransaction() { + } + + public ReceivedPaymentRelationshipsReceivePaymentTransaction data(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsReceivePaymentTransactionData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationshipsReceivePaymentTransaction receivedPaymentRelationshipsReceivePaymentTransaction = (ReceivedPaymentRelationshipsReceivePaymentTransaction) o; + return Objects.equals(this.data, receivedPaymentRelationshipsReceivePaymentTransaction.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationshipsReceivePaymentTransaction {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationshipsReceivePaymentTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationshipsReceivePaymentTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationshipsReceivePaymentTransaction is not found in the empty JSON string", ReceivedPaymentRelationshipsReceivePaymentTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentRelationshipsReceivePaymentTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentRelationshipsReceivePaymentTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationshipsReceivePaymentTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsReceivePaymentTransactionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationshipsReceivePaymentTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationshipsReceivePaymentTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationshipsReceivePaymentTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationshipsReceivePaymentTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationshipsReceivePaymentTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationshipsReceivePaymentTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationshipsReceivePaymentTransaction + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationshipsReceivePaymentTransaction + */ + public static ReceivedPaymentRelationshipsReceivePaymentTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationshipsReceivePaymentTransaction.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationshipsReceivePaymentTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsReceivePaymentTransactionData.java b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsReceivePaymentTransactionData.java new file mode 100644 index 00000000..5e21ab55 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivedPaymentRelationshipsReceivePaymentTransactionData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivedPaymentRelationshipsReceivePaymentTransactionData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivedPaymentRelationshipsReceivePaymentTransactionData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "transaction"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public ReceivedPaymentRelationshipsReceivePaymentTransactionData() { + } + + public ReceivedPaymentRelationshipsReceivePaymentTransactionData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ReceivedPaymentRelationshipsReceivePaymentTransactionData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivedPaymentRelationshipsReceivePaymentTransactionData receivedPaymentRelationshipsReceivePaymentTransactionData = (ReceivedPaymentRelationshipsReceivePaymentTransactionData) o; + return Objects.equals(this.type, receivedPaymentRelationshipsReceivePaymentTransactionData.type) && + Objects.equals(this.id, receivedPaymentRelationshipsReceivePaymentTransactionData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivedPaymentRelationshipsReceivePaymentTransactionData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivedPaymentRelationshipsReceivePaymentTransactionData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivedPaymentRelationshipsReceivePaymentTransactionData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivedPaymentRelationshipsReceivePaymentTransactionData is not found in the empty JSON string", ReceivedPaymentRelationshipsReceivePaymentTransactionData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivedPaymentRelationshipsReceivePaymentTransactionData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivedPaymentRelationshipsReceivePaymentTransactionData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivedPaymentRelationshipsReceivePaymentTransactionData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivedPaymentRelationshipsReceivePaymentTransactionData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivedPaymentRelationshipsReceivePaymentTransactionData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivedPaymentRelationshipsReceivePaymentTransactionData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivedPaymentRelationshipsReceivePaymentTransactionData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivedPaymentRelationshipsReceivePaymentTransactionData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivedPaymentRelationshipsReceivePaymentTransactionData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivedPaymentRelationshipsReceivePaymentTransactionData + * @throws IOException if the JSON string is invalid with respect to ReceivedPaymentRelationshipsReceivePaymentTransactionData + */ + public static ReceivedPaymentRelationshipsReceivePaymentTransactionData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivedPaymentRelationshipsReceivePaymentTransactionData.class); + } + + /** + * Convert an instance of ReceivedPaymentRelationshipsReceivePaymentTransactionData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReceivingAccountRelationship.java b/src/main/java/org/openapitools/client/model/ReceivingAccountRelationship.java new file mode 100644 index 00000000..66119fa3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReceivingAccountRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReceivingAccountRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReceivingAccountRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringAchPaymentRelationshipsAccountData data; + + public ReceivingAccountRelationship() { + } + + public ReceivingAccountRelationship data(RecurringAchPaymentRelationshipsAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationshipsAccountData getData() { + return data; + } + + + public void setData(RecurringAchPaymentRelationshipsAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivingAccountRelationship receivingAccountRelationship = (ReceivingAccountRelationship) o; + return Objects.equals(this.data, receivingAccountRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivingAccountRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivingAccountRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivingAccountRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivingAccountRelationship is not found in the empty JSON string", ReceivingAccountRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivingAccountRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivingAccountRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceivingAccountRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RecurringAchPaymentRelationshipsAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivingAccountRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivingAccountRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivingAccountRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivingAccountRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivingAccountRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivingAccountRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivingAccountRelationship + * @throws IOException if the JSON string is invalid with respect to ReceivingAccountRelationship + */ + public static ReceivingAccountRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivingAccountRelationship.class); + } + + /** + * Convert an instance of ReceivingAccountRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationships.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationships.java new file mode 100644 index 00000000..56abff96 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationships.java @@ -0,0 +1,309 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsAccount; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsCounterparty; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsOrg; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RecurringAchPaymentRelationshipsAccount account; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private RecurringAchPaymentRelationshipsCounterparty counterparty; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private RecurringAchPaymentRelationshipsOrg org; + + public RecurringAchPaymentRelationships() { + } + + public RecurringAchPaymentRelationships account(RecurringAchPaymentRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + public RecurringAchPaymentRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RecurringAchPaymentRelationshipsAccount account) { + this.account = account; + } + + + public RecurringAchPaymentRelationships counterparty(RecurringAchPaymentRelationshipsCounterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public RecurringAchPaymentRelationshipsCounterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(RecurringAchPaymentRelationshipsCounterparty counterparty) { + this.counterparty = counterparty; + } + + + public RecurringAchPaymentRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + public RecurringAchPaymentRelationships org(RecurringAchPaymentRelationshipsOrg org) { + + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @javax.annotation.Nullable + public RecurringAchPaymentRelationshipsOrg getOrg() { + return org; + } + + + public void setOrg(RecurringAchPaymentRelationshipsOrg org) { + this.org = org; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationships recurringAchPaymentRelationships = (RecurringAchPaymentRelationships) o; + return Objects.equals(this.account, recurringAchPaymentRelationships.account) && + Objects.equals(this.counterparty, recurringAchPaymentRelationships.counterparty) && + Objects.equals(this.customer, recurringAchPaymentRelationships.customer) && + Objects.equals(this.org, recurringAchPaymentRelationships.org); + } + + @Override + public int hashCode() { + return Objects.hash(account, counterparty, customer, org); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("counterparty"); + openapiFields.add("customer"); + openapiFields.add("org"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationships is not found in the empty JSON string", RecurringAchPaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + RecurringAchPaymentRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + RecurringAchPaymentRelationshipsCounterparty.validateJsonElement(jsonObj.get("counterparty")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `org` + if (jsonObj.get("org") != null && !jsonObj.get("org").isJsonNull()) { + RecurringAchPaymentRelationshipsOrg.validateJsonElement(jsonObj.get("org")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationships + */ + public static RecurringAchPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationships.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsAccount.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsAccount.java new file mode 100644 index 00000000..f096288c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationshipsAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationshipsAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringAchPaymentRelationshipsAccountData data; + + public RecurringAchPaymentRelationshipsAccount() { + } + + public RecurringAchPaymentRelationshipsAccount data(RecurringAchPaymentRelationshipsAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationshipsAccountData getData() { + return data; + } + + + public void setData(RecurringAchPaymentRelationshipsAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationshipsAccount recurringAchPaymentRelationshipsAccount = (RecurringAchPaymentRelationshipsAccount) o; + return Objects.equals(this.data, recurringAchPaymentRelationshipsAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationshipsAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationshipsAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationshipsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationshipsAccount is not found in the empty JSON string", RecurringAchPaymentRelationshipsAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationshipsAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationshipsAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringAchPaymentRelationshipsAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RecurringAchPaymentRelationshipsAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationshipsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationshipsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationshipsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationshipsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationshipsAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationshipsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationshipsAccount + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationshipsAccount + */ + public static RecurringAchPaymentRelationshipsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationshipsAccount.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationshipsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsAccountData.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsAccountData.java new file mode 100644 index 00000000..4a7ea663 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsAccountData.java @@ -0,0 +1,295 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationshipsAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationshipsAccountData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DEPOSITACCOUNT("depositAccount"), + + ACCOUNT("account"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RecurringAchPaymentRelationshipsAccountData() { + } + + public RecurringAchPaymentRelationshipsAccountData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public RecurringAchPaymentRelationshipsAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationshipsAccountData recurringAchPaymentRelationshipsAccountData = (RecurringAchPaymentRelationshipsAccountData) o; + return Objects.equals(this.type, recurringAchPaymentRelationshipsAccountData.type) && + Objects.equals(this.id, recurringAchPaymentRelationshipsAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationshipsAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationshipsAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationshipsAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationshipsAccountData is not found in the empty JSON string", RecurringAchPaymentRelationshipsAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationshipsAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationshipsAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringAchPaymentRelationshipsAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationshipsAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationshipsAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationshipsAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationshipsAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationshipsAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationshipsAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationshipsAccountData + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationshipsAccountData + */ + public static RecurringAchPaymentRelationshipsAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationshipsAccountData.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationshipsAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsCounterparty.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsCounterparty.java new file mode 100644 index 00000000..fe77ca2f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsCounterparty.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsCounterpartyData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationshipsCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationshipsCounterparty { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringAchPaymentRelationshipsCounterpartyData data; + + public RecurringAchPaymentRelationshipsCounterparty() { + } + + public RecurringAchPaymentRelationshipsCounterparty data(RecurringAchPaymentRelationshipsCounterpartyData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationshipsCounterpartyData getData() { + return data; + } + + + public void setData(RecurringAchPaymentRelationshipsCounterpartyData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationshipsCounterparty recurringAchPaymentRelationshipsCounterparty = (RecurringAchPaymentRelationshipsCounterparty) o; + return Objects.equals(this.data, recurringAchPaymentRelationshipsCounterparty.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationshipsCounterparty {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationshipsCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationshipsCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationshipsCounterparty is not found in the empty JSON string", RecurringAchPaymentRelationshipsCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationshipsCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationshipsCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringAchPaymentRelationshipsCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RecurringAchPaymentRelationshipsCounterpartyData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationshipsCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationshipsCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationshipsCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationshipsCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationshipsCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationshipsCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationshipsCounterparty + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationshipsCounterparty + */ + public static RecurringAchPaymentRelationshipsCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationshipsCounterparty.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationshipsCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsCounterpartyData.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsCounterpartyData.java new file mode 100644 index 00000000..fe2e192e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsCounterpartyData.java @@ -0,0 +1,295 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationshipsCounterpartyData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationshipsCounterpartyData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"), + + COUNTERPARTY("counterparty"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RecurringAchPaymentRelationshipsCounterpartyData() { + } + + public RecurringAchPaymentRelationshipsCounterpartyData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public RecurringAchPaymentRelationshipsCounterpartyData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationshipsCounterpartyData recurringAchPaymentRelationshipsCounterpartyData = (RecurringAchPaymentRelationshipsCounterpartyData) o; + return Objects.equals(this.type, recurringAchPaymentRelationshipsCounterpartyData.type) && + Objects.equals(this.id, recurringAchPaymentRelationshipsCounterpartyData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationshipsCounterpartyData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationshipsCounterpartyData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationshipsCounterpartyData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationshipsCounterpartyData is not found in the empty JSON string", RecurringAchPaymentRelationshipsCounterpartyData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationshipsCounterpartyData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationshipsCounterpartyData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringAchPaymentRelationshipsCounterpartyData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationshipsCounterpartyData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationshipsCounterpartyData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationshipsCounterpartyData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationshipsCounterpartyData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationshipsCounterpartyData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationshipsCounterpartyData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationshipsCounterpartyData + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationshipsCounterpartyData + */ + public static RecurringAchPaymentRelationshipsCounterpartyData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationshipsCounterpartyData.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationshipsCounterpartyData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsOrg.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsOrg.java new file mode 100644 index 00000000..6555dd1c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsOrg.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsOrgData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationshipsOrg + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationshipsOrg { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringAchPaymentRelationshipsOrgData data; + + public RecurringAchPaymentRelationshipsOrg() { + } + + public RecurringAchPaymentRelationshipsOrg data(RecurringAchPaymentRelationshipsOrgData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationshipsOrgData getData() { + return data; + } + + + public void setData(RecurringAchPaymentRelationshipsOrgData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationshipsOrg recurringAchPaymentRelationshipsOrg = (RecurringAchPaymentRelationshipsOrg) o; + return Objects.equals(this.data, recurringAchPaymentRelationshipsOrg.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationshipsOrg {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationshipsOrg + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationshipsOrg.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationshipsOrg is not found in the empty JSON string", RecurringAchPaymentRelationshipsOrg.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationshipsOrg.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationshipsOrg` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringAchPaymentRelationshipsOrg.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RecurringAchPaymentRelationshipsOrgData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationshipsOrg.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationshipsOrg' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationshipsOrg.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationshipsOrg value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationshipsOrg read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationshipsOrg given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationshipsOrg + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationshipsOrg + */ + public static RecurringAchPaymentRelationshipsOrg fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationshipsOrg.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationshipsOrg to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsOrgData.java b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsOrgData.java new file mode 100644 index 00000000..f8d9d033 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringAchPaymentRelationshipsOrgData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringAchPaymentRelationshipsOrgData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringAchPaymentRelationshipsOrgData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RecurringAchPaymentRelationshipsOrgData() { + } + + public RecurringAchPaymentRelationshipsOrgData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RecurringAchPaymentRelationshipsOrgData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringAchPaymentRelationshipsOrgData recurringAchPaymentRelationshipsOrgData = (RecurringAchPaymentRelationshipsOrgData) o; + return Objects.equals(this.type, recurringAchPaymentRelationshipsOrgData.type) && + Objects.equals(this.id, recurringAchPaymentRelationshipsOrgData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringAchPaymentRelationshipsOrgData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringAchPaymentRelationshipsOrgData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringAchPaymentRelationshipsOrgData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringAchPaymentRelationshipsOrgData is not found in the empty JSON string", RecurringAchPaymentRelationshipsOrgData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringAchPaymentRelationshipsOrgData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringAchPaymentRelationshipsOrgData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringAchPaymentRelationshipsOrgData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringAchPaymentRelationshipsOrgData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringAchPaymentRelationshipsOrgData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringAchPaymentRelationshipsOrgData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringAchPaymentRelationshipsOrgData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringAchPaymentRelationshipsOrgData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringAchPaymentRelationshipsOrgData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringAchPaymentRelationshipsOrgData + * @throws IOException if the JSON string is invalid with respect to RecurringAchPaymentRelationshipsOrgData + */ + public static RecurringAchPaymentRelationshipsOrgData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringAchPaymentRelationshipsOrgData.class); + } + + /** + * Convert an instance of RecurringAchPaymentRelationshipsOrgData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationships.java b/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationships.java new file mode 100644 index 00000000..4c94f607 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationships.java @@ -0,0 +1,309 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsAccount; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsOrg; +import org.openapitools.client.model.RecurringBookPaymentRelationshipsCounterpartyAccount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringBookPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringBookPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RecurringAchPaymentRelationshipsAccount account; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT = "counterpartyAccount"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT) + private RecurringBookPaymentRelationshipsCounterpartyAccount counterpartyAccount; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private RecurringAchPaymentRelationshipsOrg org; + + public RecurringBookPaymentRelationships() { + } + + public RecurringBookPaymentRelationships account(RecurringAchPaymentRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + public RecurringAchPaymentRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RecurringAchPaymentRelationshipsAccount account) { + this.account = account; + } + + + public RecurringBookPaymentRelationships counterpartyAccount(RecurringBookPaymentRelationshipsCounterpartyAccount counterpartyAccount) { + + this.counterpartyAccount = counterpartyAccount; + return this; + } + + /** + * Get counterpartyAccount + * @return counterpartyAccount + **/ + @javax.annotation.Nullable + public RecurringBookPaymentRelationshipsCounterpartyAccount getCounterpartyAccount() { + return counterpartyAccount; + } + + + public void setCounterpartyAccount(RecurringBookPaymentRelationshipsCounterpartyAccount counterpartyAccount) { + this.counterpartyAccount = counterpartyAccount; + } + + + public RecurringBookPaymentRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + public RecurringBookPaymentRelationships org(RecurringAchPaymentRelationshipsOrg org) { + + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @javax.annotation.Nullable + public RecurringAchPaymentRelationshipsOrg getOrg() { + return org; + } + + + public void setOrg(RecurringAchPaymentRelationshipsOrg org) { + this.org = org; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringBookPaymentRelationships recurringBookPaymentRelationships = (RecurringBookPaymentRelationships) o; + return Objects.equals(this.account, recurringBookPaymentRelationships.account) && + Objects.equals(this.counterpartyAccount, recurringBookPaymentRelationships.counterpartyAccount) && + Objects.equals(this.customer, recurringBookPaymentRelationships.customer) && + Objects.equals(this.org, recurringBookPaymentRelationships.org); + } + + @Override + public int hashCode() { + return Objects.hash(account, counterpartyAccount, customer, org); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringBookPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" counterpartyAccount: ").append(toIndentedString(counterpartyAccount)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("counterpartyAccount"); + openapiFields.add("customer"); + openapiFields.add("org"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringBookPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringBookPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringBookPaymentRelationships is not found in the empty JSON string", RecurringBookPaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringBookPaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringBookPaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + RecurringAchPaymentRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + } + // validate the optional field `counterpartyAccount` + if (jsonObj.get("counterpartyAccount") != null && !jsonObj.get("counterpartyAccount").isJsonNull()) { + RecurringBookPaymentRelationshipsCounterpartyAccount.validateJsonElement(jsonObj.get("counterpartyAccount")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `org` + if (jsonObj.get("org") != null && !jsonObj.get("org").isJsonNull()) { + RecurringAchPaymentRelationshipsOrg.validateJsonElement(jsonObj.get("org")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringBookPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringBookPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringBookPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringBookPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringBookPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringBookPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringBookPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to RecurringBookPaymentRelationships + */ + public static RecurringBookPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringBookPaymentRelationships.class); + } + + /** + * Convert an instance of RecurringBookPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationshipsCounterpartyAccount.java b/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationshipsCounterpartyAccount.java new file mode 100644 index 00000000..c10101dc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationshipsCounterpartyAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringBookPaymentRelationshipsCounterpartyAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringBookPaymentRelationshipsCounterpartyAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringBookPaymentRelationshipsCounterpartyAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringBookPaymentRelationshipsCounterpartyAccountData data; + + public RecurringBookPaymentRelationshipsCounterpartyAccount() { + } + + public RecurringBookPaymentRelationshipsCounterpartyAccount data(RecurringBookPaymentRelationshipsCounterpartyAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RecurringBookPaymentRelationshipsCounterpartyAccountData getData() { + return data; + } + + + public void setData(RecurringBookPaymentRelationshipsCounterpartyAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringBookPaymentRelationshipsCounterpartyAccount recurringBookPaymentRelationshipsCounterpartyAccount = (RecurringBookPaymentRelationshipsCounterpartyAccount) o; + return Objects.equals(this.data, recurringBookPaymentRelationshipsCounterpartyAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringBookPaymentRelationshipsCounterpartyAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringBookPaymentRelationshipsCounterpartyAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringBookPaymentRelationshipsCounterpartyAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringBookPaymentRelationshipsCounterpartyAccount is not found in the empty JSON string", RecurringBookPaymentRelationshipsCounterpartyAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringBookPaymentRelationshipsCounterpartyAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringBookPaymentRelationshipsCounterpartyAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringBookPaymentRelationshipsCounterpartyAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RecurringBookPaymentRelationshipsCounterpartyAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringBookPaymentRelationshipsCounterpartyAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringBookPaymentRelationshipsCounterpartyAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringBookPaymentRelationshipsCounterpartyAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringBookPaymentRelationshipsCounterpartyAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringBookPaymentRelationshipsCounterpartyAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringBookPaymentRelationshipsCounterpartyAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringBookPaymentRelationshipsCounterpartyAccount + * @throws IOException if the JSON string is invalid with respect to RecurringBookPaymentRelationshipsCounterpartyAccount + */ + public static RecurringBookPaymentRelationshipsCounterpartyAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringBookPaymentRelationshipsCounterpartyAccount.class); + } + + /** + * Convert an instance of RecurringBookPaymentRelationshipsCounterpartyAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationshipsCounterpartyAccountData.java b/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationshipsCounterpartyAccountData.java new file mode 100644 index 00000000..f5ae12d0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringBookPaymentRelationshipsCounterpartyAccountData.java @@ -0,0 +1,293 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringBookPaymentRelationshipsCounterpartyAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringBookPaymentRelationshipsCounterpartyAccountData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RecurringBookPaymentRelationshipsCounterpartyAccountData() { + } + + public RecurringBookPaymentRelationshipsCounterpartyAccountData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public RecurringBookPaymentRelationshipsCounterpartyAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringBookPaymentRelationshipsCounterpartyAccountData recurringBookPaymentRelationshipsCounterpartyAccountData = (RecurringBookPaymentRelationshipsCounterpartyAccountData) o; + return Objects.equals(this.type, recurringBookPaymentRelationshipsCounterpartyAccountData.type) && + Objects.equals(this.id, recurringBookPaymentRelationshipsCounterpartyAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringBookPaymentRelationshipsCounterpartyAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringBookPaymentRelationshipsCounterpartyAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringBookPaymentRelationshipsCounterpartyAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringBookPaymentRelationshipsCounterpartyAccountData is not found in the empty JSON string", RecurringBookPaymentRelationshipsCounterpartyAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringBookPaymentRelationshipsCounterpartyAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringBookPaymentRelationshipsCounterpartyAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringBookPaymentRelationshipsCounterpartyAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringBookPaymentRelationshipsCounterpartyAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringBookPaymentRelationshipsCounterpartyAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringBookPaymentRelationshipsCounterpartyAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringBookPaymentRelationshipsCounterpartyAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringBookPaymentRelationshipsCounterpartyAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringBookPaymentRelationshipsCounterpartyAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringBookPaymentRelationshipsCounterpartyAccountData + * @throws IOException if the JSON string is invalid with respect to RecurringBookPaymentRelationshipsCounterpartyAccountData + */ + public static RecurringBookPaymentRelationshipsCounterpartyAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringBookPaymentRelationshipsCounterpartyAccountData.class); + } + + /** + * Convert an instance of RecurringBookPaymentRelationshipsCounterpartyAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringCreditAchPayment.java b/src/main/java/org/openapitools/client/model/RecurringCreditAchPayment.java new file mode 100644 index 00000000..95f9f243 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringCreditAchPayment.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringAchPaymentRelationships; +import org.openapitools.client.model.RecurringCreditAchPaymentAllOfAttributes; +import org.openapitools.client.model.RecurringPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringCreditAchPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringCreditAchPayment extends RecurringPayment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private RecurringCreditAchPaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private RecurringAchPaymentRelationships relationships; + + public RecurringCreditAchPayment() { + this.type = this.getClass().getSimpleName(); + } + + public RecurringCreditAchPayment attributes(RecurringCreditAchPaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public RecurringCreditAchPaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(RecurringCreditAchPaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public RecurringCreditAchPayment relationships(RecurringAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(RecurringAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringCreditAchPayment recurringCreditAchPayment = (RecurringCreditAchPayment) o; + return Objects.equals(this.attributes, recurringCreditAchPayment.attributes) && + Objects.equals(this.relationships, recurringCreditAchPayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringCreditAchPayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringCreditAchPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringCreditAchPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringCreditAchPayment is not found in the empty JSON string", RecurringCreditAchPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringCreditAchPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringCreditAchPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringCreditAchPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringCreditAchPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringCreditAchPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringCreditAchPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringCreditAchPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringCreditAchPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringCreditAchPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringCreditAchPayment + * @throws IOException if the JSON string is invalid with respect to RecurringCreditAchPayment + */ + public static RecurringCreditAchPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringCreditAchPayment.class); + } + + /** + * Convert an instance of RecurringCreditAchPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringCreditAchPaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/RecurringCreditAchPaymentAllOfAttributes.java new file mode 100644 index 00000000..3e0e36f0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringCreditAchPaymentAllOfAttributes.java @@ -0,0 +1,507 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Schedule; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringCreditAchPaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringCreditAchPaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + ACTIVE("Active"), + + COMPLETED("Completed"), + + DISABLED("Disabled"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_SCHEDULE = "schedule"; + @SerializedName(SERIALIZED_NAME_SCHEDULE) + private Schedule schedule; + + public static final String SERIALIZED_NAME_NUMBER_OF_PAYMENTS = "numberOfPayments"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PAYMENTS) + private Integer numberOfPayments; + + public RecurringCreditAchPaymentAllOfAttributes() { + } + + public RecurringCreditAchPaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RecurringCreditAchPaymentAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public RecurringCreditAchPaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public RecurringCreditAchPaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public RecurringCreditAchPaymentAllOfAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public RecurringCreditAchPaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public RecurringCreditAchPaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public RecurringCreditAchPaymentAllOfAttributes schedule(Schedule schedule) { + + this.schedule = schedule; + return this; + } + + /** + * Get schedule + * @return schedule + **/ + @javax.annotation.Nonnull + public Schedule getSchedule() { + return schedule; + } + + + public void setSchedule(Schedule schedule) { + this.schedule = schedule; + } + + + public RecurringCreditAchPaymentAllOfAttributes numberOfPayments(Integer numberOfPayments) { + + this.numberOfPayments = numberOfPayments; + return this; + } + + /** + * Get numberOfPayments + * @return numberOfPayments + **/ + @javax.annotation.Nonnull + public Integer getNumberOfPayments() { + return numberOfPayments; + } + + + public void setNumberOfPayments(Integer numberOfPayments) { + this.numberOfPayments = numberOfPayments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringCreditAchPaymentAllOfAttributes recurringCreditAchPaymentAllOfAttributes = (RecurringCreditAchPaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, recurringCreditAchPaymentAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, recurringCreditAchPaymentAllOfAttributes.updatedAt) && + Objects.equals(this.amount, recurringCreditAchPaymentAllOfAttributes.amount) && + Objects.equals(this.description, recurringCreditAchPaymentAllOfAttributes.description) && + Objects.equals(this.addenda, recurringCreditAchPaymentAllOfAttributes.addenda) && + Objects.equals(this.tags, recurringCreditAchPaymentAllOfAttributes.tags) && + Objects.equals(this.status, recurringCreditAchPaymentAllOfAttributes.status) && + Objects.equals(this.schedule, recurringCreditAchPaymentAllOfAttributes.schedule) && + Objects.equals(this.numberOfPayments, recurringCreditAchPaymentAllOfAttributes.numberOfPayments); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, description, addenda, tags, status, schedule, numberOfPayments); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringCreditAchPaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); + sb.append(" numberOfPayments: ").append(toIndentedString(numberOfPayments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("tags"); + openapiFields.add("status"); + openapiFields.add("schedule"); + openapiFields.add("numberOfPayments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("schedule"); + openapiRequiredFields.add("numberOfPayments"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringCreditAchPaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringCreditAchPaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringCreditAchPaymentAllOfAttributes is not found in the empty JSON string", RecurringCreditAchPaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringCreditAchPaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringCreditAchPaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringCreditAchPaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `schedule` + Schedule.validateJsonElement(jsonObj.get("schedule")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringCreditAchPaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringCreditAchPaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringCreditAchPaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringCreditAchPaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringCreditAchPaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringCreditAchPaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringCreditAchPaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to RecurringCreditAchPaymentAllOfAttributes + */ + public static RecurringCreditAchPaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringCreditAchPaymentAllOfAttributes.class); + } + + /** + * Convert an instance of RecurringCreditAchPaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringCreditBookPayment.java b/src/main/java/org/openapitools/client/model/RecurringCreditBookPayment.java new file mode 100644 index 00000000..9b417ea5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringCreditBookPayment.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringBookPaymentRelationships; +import org.openapitools.client.model.RecurringCreditBookPaymentAllOfAttributes; +import org.openapitools.client.model.RecurringPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringCreditBookPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringCreditBookPayment extends RecurringPayment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private RecurringCreditBookPaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private RecurringBookPaymentRelationships relationships; + + public RecurringCreditBookPayment() { + this.type = this.getClass().getSimpleName(); + } + + public RecurringCreditBookPayment attributes(RecurringCreditBookPaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public RecurringCreditBookPaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(RecurringCreditBookPaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public RecurringCreditBookPayment relationships(RecurringBookPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public RecurringBookPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(RecurringBookPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringCreditBookPayment recurringCreditBookPayment = (RecurringCreditBookPayment) o; + return Objects.equals(this.attributes, recurringCreditBookPayment.attributes) && + Objects.equals(this.relationships, recurringCreditBookPayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringCreditBookPayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringCreditBookPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringCreditBookPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringCreditBookPayment is not found in the empty JSON string", RecurringCreditBookPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringCreditBookPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringCreditBookPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringCreditBookPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringCreditBookPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringCreditBookPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringCreditBookPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringCreditBookPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringCreditBookPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringCreditBookPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringCreditBookPayment + * @throws IOException if the JSON string is invalid with respect to RecurringCreditBookPayment + */ + public static RecurringCreditBookPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringCreditBookPayment.class); + } + + /** + * Convert an instance of RecurringCreditBookPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringCreditBookPaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/RecurringCreditBookPaymentAllOfAttributes.java new file mode 100644 index 00000000..ee7ea8d4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringCreditBookPaymentAllOfAttributes.java @@ -0,0 +1,477 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Schedule; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringCreditBookPaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringCreditBookPaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + ACTIVE("Active"), + + COMPLETED("Completed"), + + DISABLED("Disabled"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_SCHEDULE = "schedule"; + @SerializedName(SERIALIZED_NAME_SCHEDULE) + private Schedule schedule; + + public static final String SERIALIZED_NAME_NUMBER_OF_PAYMENTS = "numberOfPayments"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PAYMENTS) + private Integer numberOfPayments; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public RecurringCreditBookPaymentAllOfAttributes() { + } + + public RecurringCreditBookPaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RecurringCreditBookPaymentAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public RecurringCreditBookPaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public RecurringCreditBookPaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public RecurringCreditBookPaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public RecurringCreditBookPaymentAllOfAttributes schedule(Schedule schedule) { + + this.schedule = schedule; + return this; + } + + /** + * Get schedule + * @return schedule + **/ + @javax.annotation.Nonnull + public Schedule getSchedule() { + return schedule; + } + + + public void setSchedule(Schedule schedule) { + this.schedule = schedule; + } + + + public RecurringCreditBookPaymentAllOfAttributes numberOfPayments(Integer numberOfPayments) { + + this.numberOfPayments = numberOfPayments; + return this; + } + + /** + * Get numberOfPayments + * @return numberOfPayments + **/ + @javax.annotation.Nonnull + public Integer getNumberOfPayments() { + return numberOfPayments; + } + + + public void setNumberOfPayments(Integer numberOfPayments) { + this.numberOfPayments = numberOfPayments; + } + + + public RecurringCreditBookPaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringCreditBookPaymentAllOfAttributes recurringCreditBookPaymentAllOfAttributes = (RecurringCreditBookPaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, recurringCreditBookPaymentAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, recurringCreditBookPaymentAllOfAttributes.updatedAt) && + Objects.equals(this.amount, recurringCreditBookPaymentAllOfAttributes.amount) && + Objects.equals(this.description, recurringCreditBookPaymentAllOfAttributes.description) && + Objects.equals(this.status, recurringCreditBookPaymentAllOfAttributes.status) && + Objects.equals(this.schedule, recurringCreditBookPaymentAllOfAttributes.schedule) && + Objects.equals(this.numberOfPayments, recurringCreditBookPaymentAllOfAttributes.numberOfPayments) && + Objects.equals(this.tags, recurringCreditBookPaymentAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, description, status, schedule, numberOfPayments, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringCreditBookPaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); + sb.append(" numberOfPayments: ").append(toIndentedString(numberOfPayments)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("status"); + openapiFields.add("schedule"); + openapiFields.add("numberOfPayments"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("schedule"); + openapiRequiredFields.add("numberOfPayments"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringCreditBookPaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringCreditBookPaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringCreditBookPaymentAllOfAttributes is not found in the empty JSON string", RecurringCreditBookPaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringCreditBookPaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringCreditBookPaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringCreditBookPaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `schedule` + Schedule.validateJsonElement(jsonObj.get("schedule")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringCreditBookPaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringCreditBookPaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringCreditBookPaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringCreditBookPaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringCreditBookPaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringCreditBookPaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringCreditBookPaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to RecurringCreditBookPaymentAllOfAttributes + */ + public static RecurringCreditBookPaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringCreditBookPaymentAllOfAttributes.class); + } + + /** + * Convert an instance of RecurringCreditBookPaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringDebitAchPayment.java b/src/main/java/org/openapitools/client/model/RecurringDebitAchPayment.java new file mode 100644 index 00000000..7ba50374 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringDebitAchPayment.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringAchPaymentRelationships; +import org.openapitools.client.model.RecurringDebitAchPaymentAllOfAttributes; +import org.openapitools.client.model.RecurringPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringDebitAchPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringDebitAchPayment extends RecurringPayment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private RecurringDebitAchPaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private RecurringAchPaymentRelationships relationships; + + public RecurringDebitAchPayment() { + this.type = this.getClass().getSimpleName(); + } + + public RecurringDebitAchPayment attributes(RecurringDebitAchPaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public RecurringDebitAchPaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(RecurringDebitAchPaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public RecurringDebitAchPayment relationships(RecurringAchPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(RecurringAchPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringDebitAchPayment recurringDebitAchPayment = (RecurringDebitAchPayment) o; + return Objects.equals(this.attributes, recurringDebitAchPayment.attributes) && + Objects.equals(this.relationships, recurringDebitAchPayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringDebitAchPayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringDebitAchPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringDebitAchPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringDebitAchPayment is not found in the empty JSON string", RecurringDebitAchPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringDebitAchPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringDebitAchPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringDebitAchPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringDebitAchPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringDebitAchPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringDebitAchPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringDebitAchPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringDebitAchPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringDebitAchPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringDebitAchPayment + * @throws IOException if the JSON string is invalid with respect to RecurringDebitAchPayment + */ + public static RecurringDebitAchPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringDebitAchPayment.class); + } + + /** + * Convert an instance of RecurringDebitAchPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringDebitAchPaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/RecurringDebitAchPaymentAllOfAttributes.java new file mode 100644 index 00000000..0fa236a0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringDebitAchPaymentAllOfAttributes.java @@ -0,0 +1,563 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Schedule; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringDebitAchPaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringDebitAchPaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ADDENDA = "addenda"; + @SerializedName(SERIALIZED_NAME_ADDENDA) + private String addenda; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + ACTIVE("Active"), + + COMPLETED("Completed"), + + DISABLED("Disabled"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_SCHEDULE = "schedule"; + @SerializedName(SERIALIZED_NAME_SCHEDULE) + private Schedule schedule; + + public static final String SERIALIZED_NAME_NUMBER_OF_PAYMENTS = "numberOfPayments"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PAYMENTS) + private Integer numberOfPayments; + + public static final String SERIALIZED_NAME_VERIFY_COUNTERPARTY_BALANCE = "verifyCounterpartyBalance"; + @SerializedName(SERIALIZED_NAME_VERIFY_COUNTERPARTY_BALANCE) + private Boolean verifyCounterpartyBalance = false; + + public static final String SERIALIZED_NAME_SAME_DAY = "sameDay"; + @SerializedName(SERIALIZED_NAME_SAME_DAY) + private Boolean sameDay = false; + + public RecurringDebitAchPaymentAllOfAttributes() { + } + + public RecurringDebitAchPaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RecurringDebitAchPaymentAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public RecurringDebitAchPaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public RecurringDebitAchPaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public RecurringDebitAchPaymentAllOfAttributes addenda(String addenda) { + + this.addenda = addenda; + return this; + } + + /** + * Get addenda + * @return addenda + **/ + @javax.annotation.Nullable + public String getAddenda() { + return addenda; + } + + + public void setAddenda(String addenda) { + this.addenda = addenda; + } + + + public RecurringDebitAchPaymentAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public RecurringDebitAchPaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public RecurringDebitAchPaymentAllOfAttributes schedule(Schedule schedule) { + + this.schedule = schedule; + return this; + } + + /** + * Get schedule + * @return schedule + **/ + @javax.annotation.Nonnull + public Schedule getSchedule() { + return schedule; + } + + + public void setSchedule(Schedule schedule) { + this.schedule = schedule; + } + + + public RecurringDebitAchPaymentAllOfAttributes numberOfPayments(Integer numberOfPayments) { + + this.numberOfPayments = numberOfPayments; + return this; + } + + /** + * Get numberOfPayments + * @return numberOfPayments + **/ + @javax.annotation.Nonnull + public Integer getNumberOfPayments() { + return numberOfPayments; + } + + + public void setNumberOfPayments(Integer numberOfPayments) { + this.numberOfPayments = numberOfPayments; + } + + + public RecurringDebitAchPaymentAllOfAttributes verifyCounterpartyBalance(Boolean verifyCounterpartyBalance) { + + this.verifyCounterpartyBalance = verifyCounterpartyBalance; + return this; + } + + /** + * Get verifyCounterpartyBalance + * @return verifyCounterpartyBalance + **/ + @javax.annotation.Nullable + public Boolean getVerifyCounterpartyBalance() { + return verifyCounterpartyBalance; + } + + + public void setVerifyCounterpartyBalance(Boolean verifyCounterpartyBalance) { + this.verifyCounterpartyBalance = verifyCounterpartyBalance; + } + + + public RecurringDebitAchPaymentAllOfAttributes sameDay(Boolean sameDay) { + + this.sameDay = sameDay; + return this; + } + + /** + * Get sameDay + * @return sameDay + **/ + @javax.annotation.Nullable + public Boolean getSameDay() { + return sameDay; + } + + + public void setSameDay(Boolean sameDay) { + this.sameDay = sameDay; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringDebitAchPaymentAllOfAttributes recurringDebitAchPaymentAllOfAttributes = (RecurringDebitAchPaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, recurringDebitAchPaymentAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, recurringDebitAchPaymentAllOfAttributes.updatedAt) && + Objects.equals(this.amount, recurringDebitAchPaymentAllOfAttributes.amount) && + Objects.equals(this.description, recurringDebitAchPaymentAllOfAttributes.description) && + Objects.equals(this.addenda, recurringDebitAchPaymentAllOfAttributes.addenda) && + Objects.equals(this.tags, recurringDebitAchPaymentAllOfAttributes.tags) && + Objects.equals(this.status, recurringDebitAchPaymentAllOfAttributes.status) && + Objects.equals(this.schedule, recurringDebitAchPaymentAllOfAttributes.schedule) && + Objects.equals(this.numberOfPayments, recurringDebitAchPaymentAllOfAttributes.numberOfPayments) && + Objects.equals(this.verifyCounterpartyBalance, recurringDebitAchPaymentAllOfAttributes.verifyCounterpartyBalance) && + Objects.equals(this.sameDay, recurringDebitAchPaymentAllOfAttributes.sameDay); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, description, addenda, tags, status, schedule, numberOfPayments, verifyCounterpartyBalance, sameDay); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringDebitAchPaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" addenda: ").append(toIndentedString(addenda)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); + sb.append(" numberOfPayments: ").append(toIndentedString(numberOfPayments)).append("\n"); + sb.append(" verifyCounterpartyBalance: ").append(toIndentedString(verifyCounterpartyBalance)).append("\n"); + sb.append(" sameDay: ").append(toIndentedString(sameDay)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("addenda"); + openapiFields.add("tags"); + openapiFields.add("status"); + openapiFields.add("schedule"); + openapiFields.add("numberOfPayments"); + openapiFields.add("verifyCounterpartyBalance"); + openapiFields.add("sameDay"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("schedule"); + openapiRequiredFields.add("numberOfPayments"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringDebitAchPaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringDebitAchPaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringDebitAchPaymentAllOfAttributes is not found in the empty JSON string", RecurringDebitAchPaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringDebitAchPaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringDebitAchPaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringDebitAchPaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("addenda") != null && !jsonObj.get("addenda").isJsonNull()) && !jsonObj.get("addenda").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `addenda` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addenda").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `schedule` + Schedule.validateJsonElement(jsonObj.get("schedule")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringDebitAchPaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringDebitAchPaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringDebitAchPaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringDebitAchPaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringDebitAchPaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringDebitAchPaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringDebitAchPaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to RecurringDebitAchPaymentAllOfAttributes + */ + public static RecurringDebitAchPaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringDebitAchPaymentAllOfAttributes.class); + } + + /** + * Convert an instance of RecurringDebitAchPaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringPayment.java b/src/main/java/org/openapitools/client/model/RecurringPayment.java new file mode 100644 index 00000000..2d1096cb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringPayment.java @@ -0,0 +1,212 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RecurringPayment() { + this.type = this.getClass().getSimpleName(); + } + + public RecurringPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RecurringPayment id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringPayment recurringPayment = (RecurringPayment) o; + return Objects.equals(this.type, recurringPayment.type) && + Objects.equals(this.id, recurringPayment.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringPayment is not found in the empty JSON string", RecurringPayment.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "recurringCreditAchPayment": + RecurringCreditAchPayment.validateJsonElement(jsonElement); + break; + case "recurringCreditBookPayment": + RecurringCreditBookPayment.validateJsonElement(jsonElement); + break; + case "recurringDebitAchPayment": + RecurringDebitAchPayment.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of RecurringPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringPayment + * @throws IOException if the JSON string is invalid with respect to RecurringPayment + */ + public static RecurringPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringPayment.class); + } + + /** + * Convert an instance of RecurringPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringPaymentRelationship.java b/src/main/java/org/openapitools/client/model/RecurringPaymentRelationship.java new file mode 100644 index 00000000..b94f98a0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringPaymentRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringPaymentRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringPaymentRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringPaymentRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringPaymentRelationshipData data; + + public RecurringPaymentRelationship() { + } + + public RecurringPaymentRelationship data(RecurringPaymentRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RecurringPaymentRelationshipData getData() { + return data; + } + + + public void setData(RecurringPaymentRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringPaymentRelationship recurringPaymentRelationship = (RecurringPaymentRelationship) o; + return Objects.equals(this.data, recurringPaymentRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringPaymentRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringPaymentRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringPaymentRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringPaymentRelationship is not found in the empty JSON string", RecurringPaymentRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringPaymentRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringPaymentRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringPaymentRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RecurringPaymentRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringPaymentRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringPaymentRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringPaymentRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringPaymentRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringPaymentRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringPaymentRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringPaymentRelationship + * @throws IOException if the JSON string is invalid with respect to RecurringPaymentRelationship + */ + public static RecurringPaymentRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringPaymentRelationship.class); + } + + /** + * Convert an instance of RecurringPaymentRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RecurringPaymentRelationshipData.java b/src/main/java/org/openapitools/client/model/RecurringPaymentRelationshipData.java new file mode 100644 index 00000000..7a391f96 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RecurringPaymentRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RecurringPaymentRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RecurringPaymentRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "recurringPayment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RecurringPaymentRelationshipData() { + } + + public RecurringPaymentRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RecurringPaymentRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecurringPaymentRelationshipData recurringPaymentRelationshipData = (RecurringPaymentRelationshipData) o; + return Objects.equals(this.type, recurringPaymentRelationshipData.type) && + Objects.equals(this.id, recurringPaymentRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecurringPaymentRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecurringPaymentRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecurringPaymentRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecurringPaymentRelationshipData is not found in the empty JSON string", RecurringPaymentRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RecurringPaymentRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecurringPaymentRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RecurringPaymentRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecurringPaymentRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecurringPaymentRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecurringPaymentRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecurringPaymentRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RecurringPaymentRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecurringPaymentRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecurringPaymentRelationshipData + * @throws IOException if the JSON string is invalid with respect to RecurringPaymentRelationshipData + */ + public static RecurringPaymentRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecurringPaymentRelationshipData.class); + } + + /** + * Convert an instance of RecurringPaymentRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelatedTransaction.java b/src/main/java/org/openapitools/client/model/RelatedTransaction.java new file mode 100644 index 00000000..440e0b78 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelatedTransaction.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransactionData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelatedTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelatedTransaction { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsReceivePaymentTransactionData data; + + public RelatedTransaction() { + } + + public RelatedTransaction data(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsReceivePaymentTransactionData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelatedTransaction relatedTransaction = (RelatedTransaction) o; + return Objects.equals(this.data, relatedTransaction.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelatedTransaction {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelatedTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelatedTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelatedTransaction is not found in the empty JSON string", RelatedTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelatedTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelatedTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelatedTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsReceivePaymentTransactionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelatedTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelatedTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelatedTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelatedTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelatedTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelatedTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelatedTransaction + * @throws IOException if the JSON string is invalid with respect to RelatedTransaction + */ + public static RelatedTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelatedTransaction.class); + } + + /** + * Convert an instance of RelatedTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelatedTransactionRelationship.java b/src/main/java/org/openapitools/client/model/RelatedTransactionRelationship.java new file mode 100644 index 00000000..11ef1e46 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelatedTransactionRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransactionData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelatedTransactionRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelatedTransactionRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsReceivePaymentTransactionData data; + + public RelatedTransactionRelationship() { + } + + public RelatedTransactionRelationship data(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsReceivePaymentTransactionData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelatedTransactionRelationship relatedTransactionRelationship = (RelatedTransactionRelationship) o; + return Objects.equals(this.data, relatedTransactionRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelatedTransactionRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelatedTransactionRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelatedTransactionRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelatedTransactionRelationship is not found in the empty JSON string", RelatedTransactionRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelatedTransactionRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelatedTransactionRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelatedTransactionRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsReceivePaymentTransactionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelatedTransactionRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelatedTransactionRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelatedTransactionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelatedTransactionRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelatedTransactionRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelatedTransactionRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelatedTransactionRelationship + * @throws IOException if the JSON string is invalid with respect to RelatedTransactionRelationship + */ + public static RelatedTransactionRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelatedTransactionRelationship.class); + } + + /** + * Convert an instance of RelatedTransactionRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Relationship.java b/src/main/java/org/openapitools/client/model/Relationship.java new file mode 100644 index 00000000..c3817492 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Relationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Relationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Relationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RelationshipData data; + + public Relationship() { + } + + public Relationship data(RelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RelationshipData getData() { + return data; + } + + + public void setData(RelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Relationship relationship = (Relationship) o; + return Objects.equals(this.data, relationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Relationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Relationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Relationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Relationship is not found in the empty JSON string", Relationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Relationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Relationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Relationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Relationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Relationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Relationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Relationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Relationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Relationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of Relationship + * @throws IOException if the JSON string is invalid with respect to Relationship + */ + public static Relationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Relationship.class); + } + + /** + * Convert an instance of Relationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelationshipData.java b/src/main/java/org/openapitools/client/model/RelationshipData.java new file mode 100644 index 00000000..64a6cc74 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelationshipData { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public RelationshipData() { + } + + public RelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public RelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipData relationshipData = (RelationshipData) o; + return Objects.equals(this.id, relationshipData.id) && + Objects.equals(this.type, relationshipData.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipData is not found in the empty JSON string", RelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipData + * @throws IOException if the JSON string is invalid with respect to RelationshipData + */ + public static RelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipData.class); + } + + /** + * Convert an instance of RelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Relationships.java b/src/main/java/org/openapitools/client/model/Relationships.java new file mode 100644 index 00000000..9a6060fd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Relationships.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipsAccount; +import org.openapitools.client.model.RelationshipsCustomer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Relationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Relationships { + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private RelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RelationshipsAccount account; + + public Relationships() { + } + + public Relationships customer(RelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public RelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(RelationshipsCustomer customer) { + this.customer = customer; + } + + + public Relationships account(RelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public RelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RelationshipsAccount account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Relationships relationships = (Relationships) o; + return Objects.equals(this.customer, relationships.customer) && + Objects.equals(this.account, relationships.account); + } + + @Override + public int hashCode() { + return Objects.hash(customer, account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Relationships {\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("customer"); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Relationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Relationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Relationships is not found in the empty JSON string", Relationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Relationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Relationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Relationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + RelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + } + // validate the required field `account` + RelationshipsAccount.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Relationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Relationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Relationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Relationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Relationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Relationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of Relationships + * @throws IOException if the JSON string is invalid with respect to Relationships + */ + public static Relationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Relationships.class); + } + + /** + * Convert an instance of Relationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Relationships1.java b/src/main/java/org/openapitools/client/model/Relationships1.java new file mode 100644 index 00000000..ff505534 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Relationships1.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationships1Account; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Relationships1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Relationships1 { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationships1Account account; + + public Relationships1() { + } + + public Relationships1 account(Relationships1Account account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public Relationships1Account getAccount() { + return account; + } + + + public void setAccount(Relationships1Account account) { + this.account = account; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Relationships1 relationships1 = (Relationships1) o; + return Objects.equals(this.account, relationships1.account); + } + + @Override + public int hashCode() { + return Objects.hash(account); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Relationships1 {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Relationships1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Relationships1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Relationships1 is not found in the empty JSON string", Relationships1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Relationships1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Relationships1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Relationships1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + Relationships1Account.validateJsonElement(jsonObj.get("account")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Relationships1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Relationships1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Relationships1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Relationships1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Relationships1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Relationships1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Relationships1 + * @throws IOException if the JSON string is invalid with respect to Relationships1 + */ + public static Relationships1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Relationships1.class); + } + + /** + * Convert an instance of Relationships1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Relationships1Account.java b/src/main/java/org/openapitools/client/model/Relationships1Account.java new file mode 100644 index 00000000..08abf67b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Relationships1Account.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Relationships1AccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Relationships1Account + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Relationships1Account { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Relationships1AccountData data; + + public Relationships1Account() { + } + + public Relationships1Account data(Relationships1AccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public Relationships1AccountData getData() { + return data; + } + + + public void setData(Relationships1AccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Relationships1Account relationships1Account = (Relationships1Account) o; + return Objects.equals(this.data, relationships1Account.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Relationships1Account {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Relationships1Account + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Relationships1Account.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Relationships1Account is not found in the empty JSON string", Relationships1Account.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Relationships1Account.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Relationships1Account` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Relationships1Account.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + Relationships1AccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Relationships1Account.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Relationships1Account' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Relationships1Account.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Relationships1Account value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Relationships1Account read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Relationships1Account given an JSON string + * + * @param jsonString JSON string + * @return An instance of Relationships1Account + * @throws IOException if the JSON string is invalid with respect to Relationships1Account + */ + public static Relationships1Account fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Relationships1Account.class); + } + + /** + * Convert an instance of Relationships1Account to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Relationships1AccountData.java b/src/main/java/org/openapitools/client/model/Relationships1AccountData.java new file mode 100644 index 00000000..3d785eb5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Relationships1AccountData.java @@ -0,0 +1,297 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Relationships1AccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Relationships1AccountData { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ACCOUNT("account"), + + DEPOSITACCOUNT("depositAccount"), + + FINANCIALBUSINESSFBOACCOUNT("financialBusinessFBOAccount"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public Relationships1AccountData() { + } + + public Relationships1AccountData type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Relationships1AccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Relationships1AccountData relationships1AccountData = (Relationships1AccountData) o; + return Objects.equals(this.type, relationships1AccountData.type) && + Objects.equals(this.id, relationships1AccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Relationships1AccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Relationships1AccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Relationships1AccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Relationships1AccountData is not found in the empty JSON string", Relationships1AccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Relationships1AccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Relationships1AccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Relationships1AccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Relationships1AccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Relationships1AccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Relationships1AccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Relationships1AccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Relationships1AccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Relationships1AccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of Relationships1AccountData + * @throws IOException if the JSON string is invalid with respect to Relationships1AccountData + */ + public static Relationships1AccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Relationships1AccountData.class); + } + + /** + * Convert an instance of Relationships1AccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelationshipsAccount.java b/src/main/java/org/openapitools/client/model/RelationshipsAccount.java new file mode 100644 index 00000000..2860d535 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelationshipsAccount.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipsAccountData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelationshipsAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelationshipsAccount { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RelationshipsAccountData data; + + public RelationshipsAccount() { + } + + public RelationshipsAccount data(RelationshipsAccountData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RelationshipsAccountData getData() { + return data; + } + + + public void setData(RelationshipsAccountData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipsAccount relationshipsAccount = (RelationshipsAccount) o; + return Objects.equals(this.data, relationshipsAccount.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipsAccount {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipsAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipsAccount is not found in the empty JSON string", RelationshipsAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipsAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipsAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipsAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RelationshipsAccountData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipsAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipsAccount + * @throws IOException if the JSON string is invalid with respect to RelationshipsAccount + */ + public static RelationshipsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipsAccount.class); + } + + /** + * Convert an instance of RelationshipsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelationshipsAccountData.java b/src/main/java/org/openapitools/client/model/RelationshipsAccountData.java new file mode 100644 index 00000000..5cc89b0a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelationshipsAccountData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelationshipsAccountData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelationshipsAccountData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "account"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RelationshipsAccountData() { + } + + public RelationshipsAccountData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RelationshipsAccountData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipsAccountData relationshipsAccountData = (RelationshipsAccountData) o; + return Objects.equals(this.type, relationshipsAccountData.type) && + Objects.equals(this.id, relationshipsAccountData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipsAccountData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipsAccountData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipsAccountData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipsAccountData is not found in the empty JSON string", RelationshipsAccountData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipsAccountData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipsAccountData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipsAccountData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipsAccountData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipsAccountData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipsAccountData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipsAccountData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipsAccountData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipsAccountData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipsAccountData + * @throws IOException if the JSON string is invalid with respect to RelationshipsAccountData + */ + public static RelationshipsAccountData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipsAccountData.class); + } + + /** + * Convert an instance of RelationshipsAccountData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelationshipsCustomer.java b/src/main/java/org/openapitools/client/model/RelationshipsCustomer.java new file mode 100644 index 00000000..7c160f82 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelationshipsCustomer.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RelationshipsCustomerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelationshipsCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelationshipsCustomer { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RelationshipsCustomerData data; + + public RelationshipsCustomer() { + } + + public RelationshipsCustomer data(RelationshipsCustomerData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RelationshipsCustomerData getData() { + return data; + } + + + public void setData(RelationshipsCustomerData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipsCustomer relationshipsCustomer = (RelationshipsCustomer) o; + return Objects.equals(this.data, relationshipsCustomer.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipsCustomer {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipsCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipsCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipsCustomer is not found in the empty JSON string", RelationshipsCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipsCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipsCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipsCustomer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RelationshipsCustomerData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipsCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipsCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipsCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipsCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipsCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipsCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipsCustomer + * @throws IOException if the JSON string is invalid with respect to RelationshipsCustomer + */ + public static RelationshipsCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipsCustomer.class); + } + + /** + * Convert an instance of RelationshipsCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RelationshipsCustomerData.java b/src/main/java/org/openapitools/client/model/RelationshipsCustomerData.java new file mode 100644 index 00000000..423e4063 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RelationshipsCustomerData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RelationshipsCustomerData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RelationshipsCustomerData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "customer"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RelationshipsCustomerData() { + } + + public RelationshipsCustomerData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RelationshipsCustomerData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipsCustomerData relationshipsCustomerData = (RelationshipsCustomerData) o; + return Objects.equals(this.type, relationshipsCustomerData.type) && + Objects.equals(this.id, relationshipsCustomerData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipsCustomerData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelationshipsCustomerData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelationshipsCustomerData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelationshipsCustomerData is not found in the empty JSON string", RelationshipsCustomerData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelationshipsCustomerData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelationshipsCustomerData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelationshipsCustomerData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelationshipsCustomerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelationshipsCustomerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelationshipsCustomerData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelationshipsCustomerData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelationshipsCustomerData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelationshipsCustomerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelationshipsCustomerData + * @throws IOException if the JSON string is invalid with respect to RelationshipsCustomerData + */ + public static RelationshipsCustomerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelationshipsCustomerData.class); + } + + /** + * Convert an instance of RelationshipsCustomerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReleaseTransaction.java b/src/main/java/org/openapitools/client/model/ReleaseTransaction.java new file mode 100644 index 00000000..84d521b5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReleaseTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReleaseTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReleaseTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReleaseTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReleaseTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReleaseTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReleaseTransaction attributes(ReleaseTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReleaseTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReleaseTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReleaseTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReleaseTransaction releaseTransaction = (ReleaseTransaction) o; + return Objects.equals(this.attributes, releaseTransaction.attributes) && + Objects.equals(this.relationships, releaseTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReleaseTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReleaseTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReleaseTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReleaseTransaction is not found in the empty JSON string", ReleaseTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReleaseTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReleaseTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReleaseTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReleaseTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReleaseTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReleaseTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReleaseTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReleaseTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReleaseTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReleaseTransaction + * @throws IOException if the JSON string is invalid with respect to ReleaseTransaction + */ + public static ReleaseTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReleaseTransaction.class); + } + + /** + * Convert an instance of ReleaseTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReleaseTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReleaseTransactionAllOfAttributes.java new file mode 100644 index 00000000..84ba5363 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReleaseTransactionAllOfAttributes.java @@ -0,0 +1,569 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReleaseTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReleaseTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_SENDER_NAME = "senderName"; + @SerializedName(SERIALIZED_NAME_SENDER_NAME) + private String senderName; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_SENDER_ACCOUNT_NUMBER = "senderAccountNumber"; + @SerializedName(SERIALIZED_NAME_SENDER_ACCOUNT_NUMBER) + private String senderAccountNumber; + + public static final String SERIALIZED_NAME_SENDER_ADDRESS = "senderAddress"; + @SerializedName(SERIALIZED_NAME_SENDER_ADDRESS) + private Address senderAddress; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReleaseTransactionAllOfAttributes() { + } + + public ReleaseTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReleaseTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReleaseTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReleaseTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReleaseTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReleaseTransactionAllOfAttributes senderName(String senderName) { + + this.senderName = senderName; + return this; + } + + /** + * Get senderName + * @return senderName + **/ + @javax.annotation.Nullable + public String getSenderName() { + return senderName; + } + + + public void setSenderName(String senderName) { + this.senderName = senderName; + } + + + public ReleaseTransactionAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public ReleaseTransactionAllOfAttributes senderAccountNumber(String senderAccountNumber) { + + this.senderAccountNumber = senderAccountNumber; + return this; + } + + /** + * Get senderAccountNumber + * @return senderAccountNumber + **/ + @javax.annotation.Nullable + public String getSenderAccountNumber() { + return senderAccountNumber; + } + + + public void setSenderAccountNumber(String senderAccountNumber) { + this.senderAccountNumber = senderAccountNumber; + } + + + public ReleaseTransactionAllOfAttributes senderAddress(Address senderAddress) { + + this.senderAddress = senderAddress; + return this; + } + + /** + * Get senderAddress + * @return senderAddress + **/ + @javax.annotation.Nullable + public Address getSenderAddress() { + return senderAddress; + } + + + public void setSenderAddress(Address senderAddress) { + this.senderAddress = senderAddress; + } + + + public ReleaseTransactionAllOfAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public ReleaseTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReleaseTransactionAllOfAttributes releaseTransactionAllOfAttributes = (ReleaseTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, releaseTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, releaseTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, releaseTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, releaseTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, releaseTransactionAllOfAttributes.summary) && + Objects.equals(this.senderName, releaseTransactionAllOfAttributes.senderName) && + Objects.equals(this.description, releaseTransactionAllOfAttributes.description) && + Objects.equals(this.senderAccountNumber, releaseTransactionAllOfAttributes.senderAccountNumber) && + Objects.equals(this.senderAddress, releaseTransactionAllOfAttributes.senderAddress) && + Objects.equals(this.counterparty, releaseTransactionAllOfAttributes.counterparty) && + Objects.equals(this.tags, releaseTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, senderName, description, senderAccountNumber, senderAddress, counterparty, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReleaseTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" senderName: ").append(toIndentedString(senderName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" senderAccountNumber: ").append(toIndentedString(senderAccountNumber)).append("\n"); + sb.append(" senderAddress: ").append(toIndentedString(senderAddress)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("senderName"); + openapiFields.add("description"); + openapiFields.add("senderAccountNumber"); + openapiFields.add("senderAddress"); + openapiFields.add("counterparty"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReleaseTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReleaseTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReleaseTransactionAllOfAttributes is not found in the empty JSON string", ReleaseTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReleaseTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReleaseTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReleaseTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if ((jsonObj.get("senderName") != null && !jsonObj.get("senderName").isJsonNull()) && !jsonObj.get("senderName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `senderName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("senderName").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("senderAccountNumber") != null && !jsonObj.get("senderAccountNumber").isJsonNull()) && !jsonObj.get("senderAccountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `senderAccountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("senderAccountNumber").toString())); + } + // validate the optional field `senderAddress` + if (jsonObj.get("senderAddress") != null && !jsonObj.get("senderAddress").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("senderAddress")); + } + // validate the required field `counterparty` + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReleaseTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReleaseTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReleaseTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReleaseTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReleaseTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReleaseTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReleaseTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReleaseTransactionAllOfAttributes + */ + public static ReleaseTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReleaseTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReleaseTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RepaidPaymentAdvanceTransaction.java b/src/main/java/org/openapitools/client/model/RepaidPaymentAdvanceTransaction.java new file mode 100644 index 00000000..a2da95d0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RepaidPaymentAdvanceTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RepaidPaymentAdvanceTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RepaidPaymentAdvanceTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public RepaidPaymentAdvanceTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public RepaidPaymentAdvanceTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public RepaidPaymentAdvanceTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RepaidPaymentAdvanceTransaction repaidPaymentAdvanceTransaction = (RepaidPaymentAdvanceTransaction) o; + return Objects.equals(this.attributes, repaidPaymentAdvanceTransaction.attributes) && + Objects.equals(this.relationships, repaidPaymentAdvanceTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RepaidPaymentAdvanceTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RepaidPaymentAdvanceTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RepaidPaymentAdvanceTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RepaidPaymentAdvanceTransaction is not found in the empty JSON string", RepaidPaymentAdvanceTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RepaidPaymentAdvanceTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RepaidPaymentAdvanceTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RepaidPaymentAdvanceTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RepaidPaymentAdvanceTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RepaidPaymentAdvanceTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RepaidPaymentAdvanceTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RepaidPaymentAdvanceTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RepaidPaymentAdvanceTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RepaidPaymentAdvanceTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of RepaidPaymentAdvanceTransaction + * @throws IOException if the JSON string is invalid with respect to RepaidPaymentAdvanceTransaction + */ + public static RepaidPaymentAdvanceTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RepaidPaymentAdvanceTransaction.class); + } + + /** + * Convert an instance of RepaidPaymentAdvanceTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Repayment.java b/src/main/java/org/openapitools/client/model/Repayment.java new file mode 100644 index 00000000..f6ea6e90 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Repayment.java @@ -0,0 +1,209 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Repayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Repayment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public Repayment() { + this.type = this.getClass().getSimpleName(); + } + + public Repayment id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Repayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Repayment repayment = (Repayment) o; + return Objects.equals(this.id, repayment.id) && + Objects.equals(this.type, repayment.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Repayment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Repayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Repayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Repayment is not found in the empty JSON string", Repayment.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "achRepayment": + AchRepayment.validateJsonElement(jsonElement); + break; + case "bookRepayment": + BookRepayment.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Repayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of Repayment + * @throws IOException if the JSON string is invalid with respect to Repayment + */ + public static Repayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Repayment.class); + } + + /** + * Convert an instance of Repayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RepaymentRelationship.java b/src/main/java/org/openapitools/client/model/RepaymentRelationship.java new file mode 100644 index 00000000..e124f5b4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RepaymentRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RepaymentRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RepaymentRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RepaymentRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RepaymentRelationshipData data; + + public RepaymentRelationship() { + } + + public RepaymentRelationship data(RepaymentRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public RepaymentRelationshipData getData() { + return data; + } + + + public void setData(RepaymentRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RepaymentRelationship repaymentRelationship = (RepaymentRelationship) o; + return Objects.equals(this.data, repaymentRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RepaymentRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RepaymentRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RepaymentRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RepaymentRelationship is not found in the empty JSON string", RepaymentRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RepaymentRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RepaymentRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RepaymentRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + RepaymentRelationshipData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RepaymentRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RepaymentRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RepaymentRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RepaymentRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RepaymentRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RepaymentRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of RepaymentRelationship + * @throws IOException if the JSON string is invalid with respect to RepaymentRelationship + */ + public static RepaymentRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RepaymentRelationship.class); + } + + /** + * Convert an instance of RepaymentRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RepaymentRelationshipData.java b/src/main/java/org/openapitools/client/model/RepaymentRelationshipData.java new file mode 100644 index 00000000..155e50bc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RepaymentRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RepaymentRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RepaymentRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "repayment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RepaymentRelationshipData() { + } + + public RepaymentRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RepaymentRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RepaymentRelationshipData repaymentRelationshipData = (RepaymentRelationshipData) o; + return Objects.equals(this.type, repaymentRelationshipData.type) && + Objects.equals(this.id, repaymentRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RepaymentRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RepaymentRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RepaymentRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RepaymentRelationshipData is not found in the empty JSON string", RepaymentRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RepaymentRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RepaymentRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RepaymentRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RepaymentRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RepaymentRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RepaymentRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RepaymentRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RepaymentRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RepaymentRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RepaymentRelationshipData + * @throws IOException if the JSON string is invalid with respect to RepaymentRelationshipData + */ + public static RepaymentRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RepaymentRelationshipData.class); + } + + /** + * Convert an instance of RepaymentRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RequireIdVerification.java b/src/main/java/org/openapitools/client/model/RequireIdVerification.java new file mode 100644 index 00000000..b3aaeccb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RequireIdVerification.java @@ -0,0 +1,261 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RequireIdVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RequireIdVerification { + public static final String SERIALIZED_NAME_INDIVIDUAL = "individual"; + @SerializedName(SERIALIZED_NAME_INDIVIDUAL) + private Boolean individual = false; + + public static final String SERIALIZED_NAME_OFFICER = "officer"; + @SerializedName(SERIALIZED_NAME_OFFICER) + private Boolean officer = false; + + public static final String SERIALIZED_NAME_BENEFICIAL_OWNERS = "beneficialOwners"; + @SerializedName(SERIALIZED_NAME_BENEFICIAL_OWNERS) + private Boolean beneficialOwners = false; + + public RequireIdVerification() { + } + + public RequireIdVerification individual(Boolean individual) { + + this.individual = individual; + return this; + } + + /** + * Get individual + * @return individual + **/ + @javax.annotation.Nullable + public Boolean getIndividual() { + return individual; + } + + + public void setIndividual(Boolean individual) { + this.individual = individual; + } + + + public RequireIdVerification officer(Boolean officer) { + + this.officer = officer; + return this; + } + + /** + * Get officer + * @return officer + **/ + @javax.annotation.Nullable + public Boolean getOfficer() { + return officer; + } + + + public void setOfficer(Boolean officer) { + this.officer = officer; + } + + + public RequireIdVerification beneficialOwners(Boolean beneficialOwners) { + + this.beneficialOwners = beneficialOwners; + return this; + } + + /** + * Get beneficialOwners + * @return beneficialOwners + **/ + @javax.annotation.Nullable + public Boolean getBeneficialOwners() { + return beneficialOwners; + } + + + public void setBeneficialOwners(Boolean beneficialOwners) { + this.beneficialOwners = beneficialOwners; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequireIdVerification requireIdVerification = (RequireIdVerification) o; + return Objects.equals(this.individual, requireIdVerification.individual) && + Objects.equals(this.officer, requireIdVerification.officer) && + Objects.equals(this.beneficialOwners, requireIdVerification.beneficialOwners); + } + + @Override + public int hashCode() { + return Objects.hash(individual, officer, beneficialOwners); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequireIdVerification {\n"); + sb.append(" individual: ").append(toIndentedString(individual)).append("\n"); + sb.append(" officer: ").append(toIndentedString(officer)).append("\n"); + sb.append(" beneficialOwners: ").append(toIndentedString(beneficialOwners)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("individual"); + openapiFields.add("officer"); + openapiFields.add("beneficialOwners"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RequireIdVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RequireIdVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RequireIdVerification is not found in the empty JSON string", RequireIdVerification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RequireIdVerification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RequireIdVerification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RequireIdVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RequireIdVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RequireIdVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RequireIdVerification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RequireIdVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RequireIdVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of RequireIdVerification + * @throws IOException if the JSON string is invalid with respect to RequireIdVerification + */ + public static RequireIdVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RequireIdVerification.class); + } + + /** + * Convert an instance of RequireIdVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ResponseContact.java b/src/main/java/org/openapitools/client/model/ResponseContact.java new file mode 100644 index 00000000..ec8f22c3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ResponseContact.java @@ -0,0 +1,323 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ResponseContact + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ResponseContact { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public ResponseContact() { + } + + public ResponseContact fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public ResponseContact email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public ResponseContact phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public ResponseContact jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponseContact responseContact = (ResponseContact) o; + return Objects.equals(this.fullName, responseContact.fullName) && + Objects.equals(this.email, responseContact.email) && + Objects.equals(this.phone, responseContact.phone) && + Objects.equals(this.jwtSubject, responseContact.jwtSubject); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, jwtSubject); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponseContact {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("jwtSubject"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponseContact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponseContact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponseContact is not found in the empty JSON string", ResponseContact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponseContact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponseContact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResponseContact.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponseContact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponseContact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponseContact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponseContact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponseContact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponseContact given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponseContact + * @throws IOException if the JSON string is invalid with respect to ResponseContact + */ + public static ResponseContact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponseContact.class); + } + + /** + * Convert an instance of ResponseContact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnReason.java b/src/main/java/org/openapitools/client/model/ReturnReason.java new file mode 100644 index 00000000..68ddf190 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnReason.java @@ -0,0 +1,92 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets returnReason + */ +@JsonAdapter(ReturnReason.Adapter.class) +public enum ReturnReason { + + INSUFFICIENTFUNDS("InsufficientFunds"), + + ACCOUNTCLOSED("AccountClosed"), + + ALTEREDCHECK("AlteredCheck"), + + FORGEDSIGNATURE("ForgedSignature"), + + POSTDATEDCHECK("PostdatedCheck"), + + STOPPAYMENTORDER("StopPaymentOrder"), + + UNAUTHORIZEDDEBIT("UnauthorizedDebit"), + + WRONGAMOUNT("WrongAmount"), + + DUPLICATEPAYMENT("DuplicatePayment"), + + MISSINGSIGNATURE("MissingSignature"), + + IRREGULARENDORSEMENT("IrregularEndorsement"), + + OTHER("Other"); + + private String value; + + ReturnReason(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReturnReason fromValue(String value) { + for (ReturnReason b : ReturnReason.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReturnReason enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReturnReason read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReturnReason.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedAchTransaction.java b/src/main/java/org/openapitools/client/model/ReturnedAchTransaction.java new file mode 100644 index 00000000..230b6a7f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedAchTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReturnedAchTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedAchTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedAchTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReturnedAchTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReturnedAchTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReturnedAchTransaction attributes(ReturnedAchTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReturnedAchTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReturnedAchTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReturnedAchTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedAchTransaction returnedAchTransaction = (ReturnedAchTransaction) o; + return Objects.equals(this.attributes, returnedAchTransaction.attributes) && + Objects.equals(this.relationships, returnedAchTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedAchTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedAchTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedAchTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedAchTransaction is not found in the empty JSON string", ReturnedAchTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedAchTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedAchTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedAchTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedAchTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedAchTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedAchTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedAchTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedAchTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedAchTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedAchTransaction + * @throws IOException if the JSON string is invalid with respect to ReturnedAchTransaction + */ + public static ReturnedAchTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedAchTransaction.class); + } + + /** + * Convert an instance of ReturnedAchTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedAchTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReturnedAchTransactionAllOfAttributes.java new file mode 100644 index 00000000..c93ab70c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedAchTransactionAllOfAttributes.java @@ -0,0 +1,570 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedAchTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedAchTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + private String companyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_NAME = "counterpartyName"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_NAME) + private String counterpartyName; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER = "counterpartyRoutingNumber"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ROUTING_NUMBER) + private String counterpartyRoutingNumber; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_ACH_REASON = "achReason"; + @SerializedName(SERIALIZED_NAME_ACH_REASON) + private String achReason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReturnedAchTransactionAllOfAttributes() { + } + + public ReturnedAchTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReturnedAchTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReturnedAchTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReturnedAchTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReturnedAchTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReturnedAchTransactionAllOfAttributes companyName(String companyName) { + + this.companyName = companyName; + return this; + } + + /** + * Get companyName + * @return companyName + **/ + @javax.annotation.Nonnull + public String getCompanyName() { + return companyName; + } + + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + + public ReturnedAchTransactionAllOfAttributes counterpartyName(String counterpartyName) { + + this.counterpartyName = counterpartyName; + return this; + } + + /** + * Get counterpartyName + * @return counterpartyName + **/ + @javax.annotation.Nonnull + public String getCounterpartyName() { + return counterpartyName; + } + + + public void setCounterpartyName(String counterpartyName) { + this.counterpartyName = counterpartyName; + } + + + public ReturnedAchTransactionAllOfAttributes counterpartyRoutingNumber(String counterpartyRoutingNumber) { + + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + return this; + } + + /** + * Get counterpartyRoutingNumber + * @return counterpartyRoutingNumber + **/ + @javax.annotation.Nonnull + public String getCounterpartyRoutingNumber() { + return counterpartyRoutingNumber; + } + + + public void setCounterpartyRoutingNumber(String counterpartyRoutingNumber) { + this.counterpartyRoutingNumber = counterpartyRoutingNumber; + } + + + public ReturnedAchTransactionAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nonnull + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public ReturnedAchTransactionAllOfAttributes achReason(String achReason) { + + this.achReason = achReason; + return this; + } + + /** + * Get achReason + * @return achReason + **/ + @javax.annotation.Nullable + public String getAchReason() { + return achReason; + } + + + public void setAchReason(String achReason) { + this.achReason = achReason; + } + + + public ReturnedAchTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedAchTransactionAllOfAttributes returnedAchTransactionAllOfAttributes = (ReturnedAchTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, returnedAchTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, returnedAchTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, returnedAchTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, returnedAchTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, returnedAchTransactionAllOfAttributes.summary) && + Objects.equals(this.companyName, returnedAchTransactionAllOfAttributes.companyName) && + Objects.equals(this.counterpartyName, returnedAchTransactionAllOfAttributes.counterpartyName) && + Objects.equals(this.counterpartyRoutingNumber, returnedAchTransactionAllOfAttributes.counterpartyRoutingNumber) && + Objects.equals(this.reason, returnedAchTransactionAllOfAttributes.reason) && + Objects.equals(this.achReason, returnedAchTransactionAllOfAttributes.achReason) && + Objects.equals(this.tags, returnedAchTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, companyName, counterpartyName, counterpartyRoutingNumber, reason, achReason, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedAchTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" counterpartyName: ").append(toIndentedString(counterpartyName)).append("\n"); + sb.append(" counterpartyRoutingNumber: ").append(toIndentedString(counterpartyRoutingNumber)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" achReason: ").append(toIndentedString(achReason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("companyName"); + openapiFields.add("counterpartyName"); + openapiFields.add("counterpartyRoutingNumber"); + openapiFields.add("reason"); + openapiFields.add("achReason"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("companyName"); + openapiRequiredFields.add("counterpartyName"); + openapiRequiredFields.add("counterpartyRoutingNumber"); + openapiRequiredFields.add("reason"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedAchTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedAchTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedAchTransactionAllOfAttributes is not found in the empty JSON string", ReturnedAchTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedAchTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedAchTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedAchTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if (!jsonObj.get("counterpartyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyName").toString())); + } + if (!jsonObj.get("counterpartyRoutingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counterpartyRoutingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counterpartyRoutingNumber").toString())); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("achReason") != null && !jsonObj.get("achReason").isJsonNull()) && !jsonObj.get("achReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `achReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("achReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedAchTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedAchTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedAchTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedAchTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedAchTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedAchTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedAchTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReturnedAchTransactionAllOfAttributes + */ + public static ReturnedAchTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedAchTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReturnedAchTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedCheckDepositTransaction.java b/src/main/java/org/openapitools/client/model/ReturnedCheckDepositTransaction.java new file mode 100644 index 00000000..7b5394c4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedCheckDepositTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReturnedCheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedCheckDepositTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedCheckDepositTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReturnedCheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReturnedCheckDepositTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReturnedCheckDepositTransaction attributes(ReturnedCheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReturnedCheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReturnedCheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReturnedCheckDepositTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedCheckDepositTransaction returnedCheckDepositTransaction = (ReturnedCheckDepositTransaction) o; + return Objects.equals(this.attributes, returnedCheckDepositTransaction.attributes) && + Objects.equals(this.relationships, returnedCheckDepositTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedCheckDepositTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedCheckDepositTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedCheckDepositTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedCheckDepositTransaction is not found in the empty JSON string", ReturnedCheckDepositTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedCheckDepositTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedCheckDepositTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedCheckDepositTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedCheckDepositTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedCheckDepositTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedCheckDepositTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedCheckDepositTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedCheckDepositTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedCheckDepositTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedCheckDepositTransaction + * @throws IOException if the JSON string is invalid with respect to ReturnedCheckDepositTransaction + */ + public static ReturnedCheckDepositTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedCheckDepositTransaction.class); + } + + /** + * Convert an instance of ReturnedCheckDepositTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedCheckDepositTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReturnedCheckDepositTransactionAllOfAttributes.java new file mode 100644 index 00000000..93acb69a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedCheckDepositTransactionAllOfAttributes.java @@ -0,0 +1,442 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedCheckDepositTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedCheckDepositTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReturnedCheckDepositTransactionAllOfAttributes() { + } + + public ReturnedCheckDepositTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReturnedCheckDepositTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReturnedCheckDepositTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReturnedCheckDepositTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReturnedCheckDepositTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReturnedCheckDepositTransactionAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public ReturnedCheckDepositTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedCheckDepositTransactionAllOfAttributes returnedCheckDepositTransactionAllOfAttributes = (ReturnedCheckDepositTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, returnedCheckDepositTransactionAllOfAttributes.createdAt) && + Objects.equals(this.amount, returnedCheckDepositTransactionAllOfAttributes.amount) && + Objects.equals(this.direction, returnedCheckDepositTransactionAllOfAttributes.direction) && + Objects.equals(this.balance, returnedCheckDepositTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, returnedCheckDepositTransactionAllOfAttributes.summary) && + Objects.equals(this.reason, returnedCheckDepositTransactionAllOfAttributes.reason) && + Objects.equals(this.tags, returnedCheckDepositTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, balance, summary, reason, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedCheckDepositTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("reason"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedCheckDepositTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedCheckDepositTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedCheckDepositTransactionAllOfAttributes is not found in the empty JSON string", ReturnedCheckDepositTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedCheckDepositTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedCheckDepositTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedCheckDepositTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedCheckDepositTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedCheckDepositTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedCheckDepositTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedCheckDepositTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedCheckDepositTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedCheckDepositTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedCheckDepositTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReturnedCheckDepositTransactionAllOfAttributes + */ + public static ReturnedCheckDepositTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedCheckDepositTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReturnedCheckDepositTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedCheckPaymentTransaction.java b/src/main/java/org/openapitools/client/model/ReturnedCheckPaymentTransaction.java new file mode 100644 index 00000000..50b6e261 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedCheckPaymentTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReturnedCheckPaymentTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedCheckPaymentTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedCheckPaymentTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReturnedCheckPaymentTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReturnedCheckPaymentTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReturnedCheckPaymentTransaction attributes(ReturnedCheckPaymentTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReturnedCheckPaymentTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReturnedCheckPaymentTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReturnedCheckPaymentTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedCheckPaymentTransaction returnedCheckPaymentTransaction = (ReturnedCheckPaymentTransaction) o; + return Objects.equals(this.attributes, returnedCheckPaymentTransaction.attributes) && + Objects.equals(this.relationships, returnedCheckPaymentTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedCheckPaymentTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedCheckPaymentTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedCheckPaymentTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedCheckPaymentTransaction is not found in the empty JSON string", ReturnedCheckPaymentTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedCheckPaymentTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedCheckPaymentTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedCheckPaymentTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedCheckPaymentTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedCheckPaymentTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedCheckPaymentTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedCheckPaymentTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedCheckPaymentTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedCheckPaymentTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedCheckPaymentTransaction + * @throws IOException if the JSON string is invalid with respect to ReturnedCheckPaymentTransaction + */ + public static ReturnedCheckPaymentTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedCheckPaymentTransaction.class); + } + + /** + * Convert an instance of ReturnedCheckPaymentTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedCheckPaymentTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReturnedCheckPaymentTransactionAllOfAttributes.java new file mode 100644 index 00000000..c2bccaa8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedCheckPaymentTransactionAllOfAttributes.java @@ -0,0 +1,443 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedCheckPaymentTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedCheckPaymentTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReturnedCheckPaymentTransactionAllOfAttributes() { + } + + public ReturnedCheckPaymentTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReturnedCheckPaymentTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReturnedCheckPaymentTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReturnedCheckPaymentTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReturnedCheckPaymentTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReturnedCheckPaymentTransactionAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nonnull + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public ReturnedCheckPaymentTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedCheckPaymentTransactionAllOfAttributes returnedCheckPaymentTransactionAllOfAttributes = (ReturnedCheckPaymentTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, returnedCheckPaymentTransactionAllOfAttributes.createdAt) && + Objects.equals(this.amount, returnedCheckPaymentTransactionAllOfAttributes.amount) && + Objects.equals(this.direction, returnedCheckPaymentTransactionAllOfAttributes.direction) && + Objects.equals(this.balance, returnedCheckPaymentTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, returnedCheckPaymentTransactionAllOfAttributes.summary) && + Objects.equals(this.reason, returnedCheckPaymentTransactionAllOfAttributes.reason) && + Objects.equals(this.tags, returnedCheckPaymentTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, balance, summary, reason, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedCheckPaymentTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("reason"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("reason"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedCheckPaymentTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedCheckPaymentTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedCheckPaymentTransactionAllOfAttributes is not found in the empty JSON string", ReturnedCheckPaymentTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedCheckPaymentTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedCheckPaymentTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedCheckPaymentTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedCheckPaymentTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedCheckPaymentTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedCheckPaymentTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedCheckPaymentTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedCheckPaymentTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedCheckPaymentTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedCheckPaymentTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReturnedCheckPaymentTransactionAllOfAttributes + */ + public static ReturnedCheckPaymentTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedCheckPaymentTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReturnedCheckPaymentTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedReceivedAchTransaction.java b/src/main/java/org/openapitools/client/model/ReturnedReceivedAchTransaction.java new file mode 100644 index 00000000..7fd18afc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedReceivedAchTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReturnedReceivedAchTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedReceivedAchTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedReceivedAchTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReturnedReceivedAchTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReturnedReceivedAchTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReturnedReceivedAchTransaction attributes(ReturnedReceivedAchTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReturnedReceivedAchTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReturnedReceivedAchTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReturnedReceivedAchTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedReceivedAchTransaction returnedReceivedAchTransaction = (ReturnedReceivedAchTransaction) o; + return Objects.equals(this.attributes, returnedReceivedAchTransaction.attributes) && + Objects.equals(this.relationships, returnedReceivedAchTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedReceivedAchTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedReceivedAchTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedReceivedAchTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedReceivedAchTransaction is not found in the empty JSON string", ReturnedReceivedAchTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedReceivedAchTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedReceivedAchTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedReceivedAchTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedReceivedAchTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedReceivedAchTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedReceivedAchTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedReceivedAchTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedReceivedAchTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedReceivedAchTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedReceivedAchTransaction + * @throws IOException if the JSON string is invalid with respect to ReturnedReceivedAchTransaction + */ + public static ReturnedReceivedAchTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedReceivedAchTransaction.class); + } + + /** + * Convert an instance of ReturnedReceivedAchTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedReceivedAchTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReturnedReceivedAchTransactionAllOfAttributes.java new file mode 100644 index 00000000..77ccb811 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedReceivedAchTransactionAllOfAttributes.java @@ -0,0 +1,475 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedReceivedAchTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedReceivedAchTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + private String companyName; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public ReturnedReceivedAchTransactionAllOfAttributes() { + } + + public ReturnedReceivedAchTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes companyName(String companyName) { + + this.companyName = companyName; + return this; + } + + /** + * Get companyName + * @return companyName + **/ + @javax.annotation.Nonnull + public String getCompanyName() { + return companyName; + } + + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nonnull + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public ReturnedReceivedAchTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedReceivedAchTransactionAllOfAttributes returnedReceivedAchTransactionAllOfAttributes = (ReturnedReceivedAchTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, returnedReceivedAchTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, returnedReceivedAchTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, returnedReceivedAchTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, returnedReceivedAchTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, returnedReceivedAchTransactionAllOfAttributes.summary) && + Objects.equals(this.companyName, returnedReceivedAchTransactionAllOfAttributes.companyName) && + Objects.equals(this.reason, returnedReceivedAchTransactionAllOfAttributes.reason) && + Objects.equals(this.tags, returnedReceivedAchTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, companyName, reason, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedReceivedAchTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("companyName"); + openapiFields.add("reason"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("companyName"); + openapiRequiredFields.add("reason"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedReceivedAchTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedReceivedAchTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedReceivedAchTransactionAllOfAttributes is not found in the empty JSON string", ReturnedReceivedAchTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedReceivedAchTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedReceivedAchTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedReceivedAchTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedReceivedAchTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedReceivedAchTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedReceivedAchTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedReceivedAchTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedReceivedAchTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedReceivedAchTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedReceivedAchTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReturnedReceivedAchTransactionAllOfAttributes + */ + public static ReturnedReceivedAchTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedReceivedAchTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReturnedReceivedAchTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReturnedRelationship.java b/src/main/java/org/openapitools/client/model/ReturnedRelationship.java new file mode 100644 index 00000000..c1fe8c75 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReturnedRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransactionData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReturnedRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReturnedRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsReceivePaymentTransactionData data; + + public ReturnedRelationship() { + } + + public ReturnedRelationship data(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsReceivePaymentTransactionData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnedRelationship returnedRelationship = (ReturnedRelationship) o; + return Objects.equals(this.data, returnedRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnedRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnedRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnedRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnedRelationship is not found in the empty JSON string", ReturnedRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnedRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnedRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnedRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsReceivePaymentTransactionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnedRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnedRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnedRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnedRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnedRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnedRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnedRelationship + * @throws IOException if the JSON string is invalid with respect to ReturnedRelationship + */ + public static ReturnedRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnedRelationship.class); + } + + /** + * Convert an instance of ReturnedRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReversalTransaction.java b/src/main/java/org/openapitools/client/model/ReversalTransaction.java new file mode 100644 index 00000000..b1cb84e3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReversalTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReversalTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReversalTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReversalTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private ReversalTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public ReversalTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public ReversalTransaction attributes(ReversalTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public ReversalTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(ReversalTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public ReversalTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReversalTransaction reversalTransaction = (ReversalTransaction) o; + return Objects.equals(this.attributes, reversalTransaction.attributes) && + Objects.equals(this.relationships, reversalTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReversalTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReversalTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReversalTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReversalTransaction is not found in the empty JSON string", ReversalTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReversalTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReversalTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReversalTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReversalTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReversalTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReversalTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReversalTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReversalTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReversalTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReversalTransaction + * @throws IOException if the JSON string is invalid with respect to ReversalTransaction + */ + public static ReversalTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReversalTransaction.class); + } + + /** + * Convert an instance of ReversalTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ReversalTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/ReversalTransactionAllOfAttributes.java new file mode 100644 index 00000000..778f0591 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/ReversalTransactionAllOfAttributes.java @@ -0,0 +1,514 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReversalTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReversalTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_CARD_LAST4_DIGITS = "cardLast4Digits"; + @SerializedName(SERIALIZED_NAME_CARD_LAST4_DIGITS) + private String cardLast4Digits; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_NETWORK_TRANSACTION_ID = "networkTransactionId"; + @SerializedName(SERIALIZED_NAME_NETWORK_TRANSACTION_ID) + private String networkTransactionId; + + public static final String SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE = "internationalServiceFee"; + @SerializedName(SERIALIZED_NAME_INTERNATIONAL_SERVICE_FEE) + private Integer internationalServiceFee; + + public ReversalTransactionAllOfAttributes() { + } + + public ReversalTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReversalTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public ReversalTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public ReversalTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public ReversalTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public ReversalTransactionAllOfAttributes cardLast4Digits(String cardLast4Digits) { + + this.cardLast4Digits = cardLast4Digits; + return this; + } + + /** + * Get cardLast4Digits + * @return cardLast4Digits + **/ + @javax.annotation.Nonnull + public String getCardLast4Digits() { + return cardLast4Digits; + } + + + public void setCardLast4Digits(String cardLast4Digits) { + this.cardLast4Digits = cardLast4Digits; + } + + + public ReversalTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public ReversalTransactionAllOfAttributes networkTransactionId(String networkTransactionId) { + + this.networkTransactionId = networkTransactionId; + return this; + } + + /** + * Get networkTransactionId + * @return networkTransactionId + **/ + @javax.annotation.Nullable + public String getNetworkTransactionId() { + return networkTransactionId; + } + + + public void setNetworkTransactionId(String networkTransactionId) { + this.networkTransactionId = networkTransactionId; + } + + + public ReversalTransactionAllOfAttributes internationalServiceFee(Integer internationalServiceFee) { + + this.internationalServiceFee = internationalServiceFee; + return this; + } + + /** + * Get internationalServiceFee + * @return internationalServiceFee + **/ + @javax.annotation.Nullable + public Integer getInternationalServiceFee() { + return internationalServiceFee; + } + + + public void setInternationalServiceFee(Integer internationalServiceFee) { + this.internationalServiceFee = internationalServiceFee; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReversalTransactionAllOfAttributes reversalTransactionAllOfAttributes = (ReversalTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, reversalTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, reversalTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, reversalTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, reversalTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, reversalTransactionAllOfAttributes.summary) && + Objects.equals(this.cardLast4Digits, reversalTransactionAllOfAttributes.cardLast4Digits) && + Objects.equals(this.tags, reversalTransactionAllOfAttributes.tags) && + Objects.equals(this.networkTransactionId, reversalTransactionAllOfAttributes.networkTransactionId) && + Objects.equals(this.internationalServiceFee, reversalTransactionAllOfAttributes.internationalServiceFee); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, cardLast4Digits, tags, networkTransactionId, internationalServiceFee); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReversalTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" cardLast4Digits: ").append(toIndentedString(cardLast4Digits)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" networkTransactionId: ").append(toIndentedString(networkTransactionId)).append("\n"); + sb.append(" internationalServiceFee: ").append(toIndentedString(internationalServiceFee)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("cardLast4Digits"); + openapiFields.add("tags"); + openapiFields.add("networkTransactionId"); + openapiFields.add("internationalServiceFee"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("cardLast4Digits"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReversalTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReversalTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReversalTransactionAllOfAttributes is not found in the empty JSON string", ReversalTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReversalTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReversalTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReversalTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + if (!jsonObj.get("cardLast4Digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardLast4Digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardLast4Digits").toString())); + } + if ((jsonObj.get("networkTransactionId") != null && !jsonObj.get("networkTransactionId").isJsonNull()) && !jsonObj.get("networkTransactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `networkTransactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("networkTransactionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReversalTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReversalTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReversalTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReversalTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReversalTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReversalTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReversalTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to ReversalTransactionAllOfAttributes + */ + public static ReversalTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReversalTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of ReversalTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Revocability.java b/src/main/java/org/openapitools/client/model/Revocability.java new file mode 100644 index 00000000..05672e83 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Revocability.java @@ -0,0 +1,72 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets revocability + */ +@JsonAdapter(Revocability.Adapter.class) +public enum Revocability { + + REVOCABLE("Revocable"), + + IRREVOCABLE("Irrevocable"); + + private String value; + + Revocability(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Revocability fromValue(String value) { + for (Revocability b : Revocability.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final Revocability enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public Revocability read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return Revocability.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/Reward.java b/src/main/java/org/openapitools/client/model/Reward.java new file mode 100644 index 00000000..3413cac2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Reward.java @@ -0,0 +1,312 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RewardAttributes; +import org.openapitools.client.model.RewardRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Reward + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Reward { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "reward"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private RewardAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private RewardRelationships relationships; + + public Reward() { + } + + public Reward type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Reward id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Reward attributes(RewardAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public RewardAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(RewardAttributes attributes) { + this.attributes = attributes; + } + + + public Reward relationships(RewardRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public RewardRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(RewardRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Reward reward = (Reward) o; + return Objects.equals(this.type, reward.type) && + Objects.equals(this.id, reward.id) && + Objects.equals(this.attributes, reward.attributes) && + Objects.equals(this.relationships, reward.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Reward {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Reward + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Reward.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Reward is not found in the empty JSON string", Reward.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Reward.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Reward` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Reward.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + RewardAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + RewardRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Reward.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Reward' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Reward.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Reward value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Reward read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Reward given an JSON string + * + * @param jsonString JSON string + * @return An instance of Reward + * @throws IOException if the JSON string is invalid with respect to Reward + */ + public static Reward fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Reward.class); + } + + /** + * Convert an instance of Reward to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RewardAttributes.java b/src/main/java/org/openapitools/client/model/RewardAttributes.java new file mode 100644 index 00000000..ec0c58e7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RewardAttributes.java @@ -0,0 +1,415 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RewardAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RewardAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + REJECTED("Rejected"), + + SENT("Sent"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_REJECT_REASON = "rejectReason"; + @SerializedName(SERIALIZED_NAME_REJECT_REASON) + private String rejectReason; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public RewardAttributes() { + } + + public RewardAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RewardAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public RewardAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public RewardAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public RewardAttributes rejectReason(String rejectReason) { + + this.rejectReason = rejectReason; + return this; + } + + /** + * Get rejectReason + * @return rejectReason + **/ + @javax.annotation.Nullable + public String getRejectReason() { + return rejectReason; + } + + + public void setRejectReason(String rejectReason) { + this.rejectReason = rejectReason; + } + + + public RewardAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nonnull + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RewardAttributes rewardAttributes = (RewardAttributes) o; + return Objects.equals(this.createdAt, rewardAttributes.createdAt) && + Objects.equals(this.amount, rewardAttributes.amount) && + Objects.equals(this.description, rewardAttributes.description) && + Objects.equals(this.status, rewardAttributes.status) && + Objects.equals(this.rejectReason, rewardAttributes.rejectReason) && + Objects.equals(this.tags, rewardAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, description, status, rejectReason, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RewardAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" rejectReason: ").append(toIndentedString(rejectReason)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("description"); + openapiFields.add("status"); + openapiFields.add("rejectReason"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("tags"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RewardAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RewardAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RewardAttributes is not found in the empty JSON string", RewardAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RewardAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RewardAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RewardAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("rejectReason") != null && !jsonObj.get("rejectReason").isJsonNull()) && !jsonObj.get("rejectReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rejectReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rejectReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RewardAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RewardAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RewardAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RewardAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RewardAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RewardAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of RewardAttributes + * @throws IOException if the JSON string is invalid with respect to RewardAttributes + */ + public static RewardAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RewardAttributes.class); + } + + /** + * Convert an instance of RewardAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RewardRelationship.java b/src/main/java/org/openapitools/client/model/RewardRelationship.java new file mode 100644 index 00000000..3d1debe3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RewardRelationship.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RewardRelationshipData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RewardRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RewardRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RewardRelationshipData data; + + public RewardRelationship() { + } + + public RewardRelationship data(RewardRelationshipData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public RewardRelationshipData getData() { + return data; + } + + + public void setData(RewardRelationshipData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RewardRelationship rewardRelationship = (RewardRelationship) o; + return Objects.equals(this.data, rewardRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RewardRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RewardRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RewardRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RewardRelationship is not found in the empty JSON string", RewardRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RewardRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RewardRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + RewardRelationshipData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RewardRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RewardRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RewardRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RewardRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RewardRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RewardRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of RewardRelationship + * @throws IOException if the JSON string is invalid with respect to RewardRelationship + */ + public static RewardRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RewardRelationship.class); + } + + /** + * Convert an instance of RewardRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RewardRelationshipData.java b/src/main/java/org/openapitools/client/model/RewardRelationshipData.java new file mode 100644 index 00000000..dd80a517 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RewardRelationshipData.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RewardRelationshipData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RewardRelationshipData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "reward"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public RewardRelationshipData() { + } + + public RewardRelationshipData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public RewardRelationshipData id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RewardRelationshipData rewardRelationshipData = (RewardRelationshipData) o; + return Objects.equals(this.type, rewardRelationshipData.type) && + Objects.equals(this.id, rewardRelationshipData.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RewardRelationshipData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RewardRelationshipData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RewardRelationshipData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RewardRelationshipData is not found in the empty JSON string", RewardRelationshipData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RewardRelationshipData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RewardRelationshipData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RewardRelationshipData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RewardRelationshipData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RewardRelationshipData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RewardRelationshipData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RewardRelationshipData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RewardRelationshipData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RewardRelationshipData given an JSON string + * + * @param jsonString JSON string + * @return An instance of RewardRelationshipData + * @throws IOException if the JSON string is invalid with respect to RewardRelationshipData + */ + public static RewardRelationshipData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RewardRelationshipData.class); + } + + /** + * Convert an instance of RewardRelationshipData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RewardRelationships.java b/src/main/java/org/openapitools/client/model/RewardRelationships.java new file mode 100644 index 00000000..0b083447 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RewardRelationships.java @@ -0,0 +1,376 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CardRelationship; +import org.openapitools.client.model.Relationship; +import org.openapitools.client.model.TransactionRelationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RewardRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RewardRelationships { + public static final String SERIALIZED_NAME_RECEIVING_ACCOUNT = "receivingAccount"; + @SerializedName(SERIALIZED_NAME_RECEIVING_ACCOUNT) + private Relationship receivingAccount; + + public static final String SERIALIZED_NAME_FUNDING_ACCOUNT = "fundingAccount"; + @SerializedName(SERIALIZED_NAME_FUNDING_ACCOUNT) + private Relationship fundingAccount; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public static final String SERIALIZED_NAME_REWARDED_TRANSACTION = "rewardedTransaction"; + @SerializedName(SERIALIZED_NAME_REWARDED_TRANSACTION) + private Relationship rewardedTransaction; + + public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; + @SerializedName(SERIALIZED_NAME_TRANSACTION) + private TransactionRelationship transaction; + + public static final String SERIALIZED_NAME_CARD = "card"; + @SerializedName(SERIALIZED_NAME_CARD) + private CardRelationship card; + + public RewardRelationships() { + } + + public RewardRelationships receivingAccount(Relationship receivingAccount) { + + this.receivingAccount = receivingAccount; + return this; + } + + /** + * Get receivingAccount + * @return receivingAccount + **/ + @javax.annotation.Nonnull + public Relationship getReceivingAccount() { + return receivingAccount; + } + + + public void setReceivingAccount(Relationship receivingAccount) { + this.receivingAccount = receivingAccount; + } + + + public RewardRelationships fundingAccount(Relationship fundingAccount) { + + this.fundingAccount = fundingAccount; + return this; + } + + /** + * Get fundingAccount + * @return fundingAccount + **/ + @javax.annotation.Nonnull + public Relationship getFundingAccount() { + return fundingAccount; + } + + + public void setFundingAccount(Relationship fundingAccount) { + this.fundingAccount = fundingAccount; + } + + + public RewardRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + public RewardRelationships rewardedTransaction(Relationship rewardedTransaction) { + + this.rewardedTransaction = rewardedTransaction; + return this; + } + + /** + * Get rewardedTransaction + * @return rewardedTransaction + **/ + @javax.annotation.Nullable + public Relationship getRewardedTransaction() { + return rewardedTransaction; + } + + + public void setRewardedTransaction(Relationship rewardedTransaction) { + this.rewardedTransaction = rewardedTransaction; + } + + + public RewardRelationships transaction(TransactionRelationship transaction) { + + this.transaction = transaction; + return this; + } + + /** + * Get transaction + * @return transaction + **/ + @javax.annotation.Nullable + public TransactionRelationship getTransaction() { + return transaction; + } + + + public void setTransaction(TransactionRelationship transaction) { + this.transaction = transaction; + } + + + public RewardRelationships card(CardRelationship card) { + + this.card = card; + return this; + } + + /** + * Get card + * @return card + **/ + @javax.annotation.Nullable + public CardRelationship getCard() { + return card; + } + + + public void setCard(CardRelationship card) { + this.card = card; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RewardRelationships rewardRelationships = (RewardRelationships) o; + return Objects.equals(this.receivingAccount, rewardRelationships.receivingAccount) && + Objects.equals(this.fundingAccount, rewardRelationships.fundingAccount) && + Objects.equals(this.customer, rewardRelationships.customer) && + Objects.equals(this.rewardedTransaction, rewardRelationships.rewardedTransaction) && + Objects.equals(this.transaction, rewardRelationships.transaction) && + Objects.equals(this.card, rewardRelationships.card); + } + + @Override + public int hashCode() { + return Objects.hash(receivingAccount, fundingAccount, customer, rewardedTransaction, transaction, card); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RewardRelationships {\n"); + sb.append(" receivingAccount: ").append(toIndentedString(receivingAccount)).append("\n"); + sb.append(" fundingAccount: ").append(toIndentedString(fundingAccount)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" rewardedTransaction: ").append(toIndentedString(rewardedTransaction)).append("\n"); + sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); + sb.append(" card: ").append(toIndentedString(card)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("receivingAccount"); + openapiFields.add("fundingAccount"); + openapiFields.add("customer"); + openapiFields.add("rewardedTransaction"); + openapiFields.add("transaction"); + openapiFields.add("card"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("receivingAccount"); + openapiRequiredFields.add("fundingAccount"); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RewardRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RewardRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RewardRelationships is not found in the empty JSON string", RewardRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RewardRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RewardRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RewardRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `receivingAccount` + Relationship.validateJsonElement(jsonObj.get("receivingAccount")); + // validate the required field `fundingAccount` + Relationship.validateJsonElement(jsonObj.get("fundingAccount")); + // validate the required field `customer` + Relationship.validateJsonElement(jsonObj.get("customer")); + // validate the optional field `rewardedTransaction` + if (jsonObj.get("rewardedTransaction") != null && !jsonObj.get("rewardedTransaction").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("rewardedTransaction")); + } + // validate the optional field `transaction` + if (jsonObj.get("transaction") != null && !jsonObj.get("transaction").isJsonNull()) { + TransactionRelationship.validateJsonElement(jsonObj.get("transaction")); + } + // validate the optional field `card` + if (jsonObj.get("card") != null && !jsonObj.get("card").isJsonNull()) { + CardRelationship.validateJsonElement(jsonObj.get("card")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RewardRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RewardRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RewardRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RewardRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RewardRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RewardRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of RewardRelationships + * @throws IOException if the JSON string is invalid with respect to RewardRelationships + */ + public static RewardRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RewardRelationships.class); + } + + /** + * Convert an instance of RewardRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RewardTransaction.java b/src/main/java/org/openapitools/client/model/RewardTransaction.java new file mode 100644 index 00000000..757f7943 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RewardTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RewardTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RewardTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RewardTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private RewardTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public RewardTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public RewardTransaction attributes(RewardTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public RewardTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(RewardTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public RewardTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RewardTransaction rewardTransaction = (RewardTransaction) o; + return Objects.equals(this.attributes, rewardTransaction.attributes) && + Objects.equals(this.relationships, rewardTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RewardTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RewardTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RewardTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RewardTransaction is not found in the empty JSON string", RewardTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RewardTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RewardTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RewardTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RewardTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RewardTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RewardTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RewardTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RewardTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RewardTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of RewardTransaction + * @throws IOException if the JSON string is invalid with respect to RewardTransaction + */ + public static RewardTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RewardTransaction.class); + } + + /** + * Convert an instance of RewardTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/RewardTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/RewardTransactionAllOfAttributes.java new file mode 100644 index 00000000..7fc5a291 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/RewardTransactionAllOfAttributes.java @@ -0,0 +1,443 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RewardTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RewardTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_RECEIVER_COUNTERPARTY = "receiverCounterparty"; + @SerializedName(SERIALIZED_NAME_RECEIVER_COUNTERPARTY) + private Counterparty receiverCounterparty; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public RewardTransactionAllOfAttributes() { + } + + public RewardTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RewardTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public RewardTransactionAllOfAttributes receiverCounterparty(Counterparty receiverCounterparty) { + + this.receiverCounterparty = receiverCounterparty; + return this; + } + + /** + * Get receiverCounterparty + * @return receiverCounterparty + **/ + @javax.annotation.Nonnull + public Counterparty getReceiverCounterparty() { + return receiverCounterparty; + } + + + public void setReceiverCounterparty(Counterparty receiverCounterparty) { + this.receiverCounterparty = receiverCounterparty; + } + + + public RewardTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public RewardTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public RewardTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public RewardTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RewardTransactionAllOfAttributes rewardTransactionAllOfAttributes = (RewardTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, rewardTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, rewardTransactionAllOfAttributes.direction) && + Objects.equals(this.receiverCounterparty, rewardTransactionAllOfAttributes.receiverCounterparty) && + Objects.equals(this.amount, rewardTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, rewardTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, rewardTransactionAllOfAttributes.summary) && + Objects.equals(this.tags, rewardTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, receiverCounterparty, amount, balance, summary, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RewardTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" receiverCounterparty: ").append(toIndentedString(receiverCounterparty)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("receiverCounterparty"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("receiverCounterparty"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RewardTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RewardTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RewardTransactionAllOfAttributes is not found in the empty JSON string", RewardTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RewardTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RewardTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RewardTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + // validate the required field `receiverCounterparty` + Counterparty.validateJsonElement(jsonObj.get("receiverCounterparty")); + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RewardTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RewardTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RewardTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RewardTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RewardTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RewardTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of RewardTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to RewardTransactionAllOfAttributes + */ + public static RewardTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RewardTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of RewardTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Schedule.java b/src/main/java/org/openapitools/client/model/Schedule.java new file mode 100644 index 00000000..0acbb843 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Schedule.java @@ -0,0 +1,406 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Schedule + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Schedule { + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private LocalDate startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private LocalDate endTime; + + /** + * Gets or Sets interval + */ + @JsonAdapter(IntervalEnum.Adapter.class) + public enum IntervalEnum { + MONTHLY("Monthly"); + + private String value; + + IntervalEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static IntervalEnum fromValue(String value) { + for (IntervalEnum b : IntervalEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final IntervalEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public IntervalEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return IntervalEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_INTERVAL = "interval"; + @SerializedName(SERIALIZED_NAME_INTERVAL) + private IntervalEnum interval; + + public static final String SERIALIZED_NAME_DAY_OF_MONTH = "dayOfMonth"; + @SerializedName(SERIALIZED_NAME_DAY_OF_MONTH) + private Integer dayOfMonth; + + public static final String SERIALIZED_NAME_NEXT_SCHEDULED_ACTION = "nextScheduledAction"; + @SerializedName(SERIALIZED_NAME_NEXT_SCHEDULED_ACTION) + private LocalDate nextScheduledAction; + + public static final String SERIALIZED_NAME_TOTAL_NUMBER_OF_PAYMENTS = "totalNumberOfPayments"; + @SerializedName(SERIALIZED_NAME_TOTAL_NUMBER_OF_PAYMENTS) + private Integer totalNumberOfPayments; + + public Schedule() { + } + + public Schedule startTime(LocalDate startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + **/ + @javax.annotation.Nullable + public LocalDate getStartTime() { + return startTime; + } + + + public void setStartTime(LocalDate startTime) { + this.startTime = startTime; + } + + + public Schedule endTime(LocalDate endTime) { + + this.endTime = endTime; + return this; + } + + /** + * Get endTime + * @return endTime + **/ + @javax.annotation.Nullable + public LocalDate getEndTime() { + return endTime; + } + + + public void setEndTime(LocalDate endTime) { + this.endTime = endTime; + } + + + public Schedule interval(IntervalEnum interval) { + + this.interval = interval; + return this; + } + + /** + * Get interval + * @return interval + **/ + @javax.annotation.Nonnull + public IntervalEnum getInterval() { + return interval; + } + + + public void setInterval(IntervalEnum interval) { + this.interval = interval; + } + + + public Schedule dayOfMonth(Integer dayOfMonth) { + + this.dayOfMonth = dayOfMonth; + return this; + } + + /** + * Get dayOfMonth + * minimum: -5 + * maximum: 28 + * @return dayOfMonth + **/ + @javax.annotation.Nullable + public Integer getDayOfMonth() { + return dayOfMonth; + } + + + public void setDayOfMonth(Integer dayOfMonth) { + this.dayOfMonth = dayOfMonth; + } + + + public Schedule nextScheduledAction(LocalDate nextScheduledAction) { + + this.nextScheduledAction = nextScheduledAction; + return this; + } + + /** + * Get nextScheduledAction + * @return nextScheduledAction + **/ + @javax.annotation.Nonnull + public LocalDate getNextScheduledAction() { + return nextScheduledAction; + } + + + public void setNextScheduledAction(LocalDate nextScheduledAction) { + this.nextScheduledAction = nextScheduledAction; + } + + + public Schedule totalNumberOfPayments(Integer totalNumberOfPayments) { + + this.totalNumberOfPayments = totalNumberOfPayments; + return this; + } + + /** + * Get totalNumberOfPayments + * minimum: 1 + * @return totalNumberOfPayments + **/ + @javax.annotation.Nullable + public Integer getTotalNumberOfPayments() { + return totalNumberOfPayments; + } + + + public void setTotalNumberOfPayments(Integer totalNumberOfPayments) { + this.totalNumberOfPayments = totalNumberOfPayments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Schedule schedule = (Schedule) o; + return Objects.equals(this.startTime, schedule.startTime) && + Objects.equals(this.endTime, schedule.endTime) && + Objects.equals(this.interval, schedule.interval) && + Objects.equals(this.dayOfMonth, schedule.dayOfMonth) && + Objects.equals(this.nextScheduledAction, schedule.nextScheduledAction) && + Objects.equals(this.totalNumberOfPayments, schedule.totalNumberOfPayments); + } + + @Override + public int hashCode() { + return Objects.hash(startTime, endTime, interval, dayOfMonth, nextScheduledAction, totalNumberOfPayments); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Schedule {\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" interval: ").append(toIndentedString(interval)).append("\n"); + sb.append(" dayOfMonth: ").append(toIndentedString(dayOfMonth)).append("\n"); + sb.append(" nextScheduledAction: ").append(toIndentedString(nextScheduledAction)).append("\n"); + sb.append(" totalNumberOfPayments: ").append(toIndentedString(totalNumberOfPayments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("interval"); + openapiFields.add("dayOfMonth"); + openapiFields.add("nextScheduledAction"); + openapiFields.add("totalNumberOfPayments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("interval"); + openapiRequiredFields.add("nextScheduledAction"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Schedule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Schedule.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Schedule is not found in the empty JSON string", Schedule.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Schedule.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Schedule` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Schedule.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("interval").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `interval` to be a primitive type in the JSON string but got `%s`", jsonObj.get("interval").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Schedule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Schedule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Schedule.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Schedule value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Schedule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Schedule given an JSON string + * + * @param jsonString JSON string + * @return An instance of Schedule + * @throws IOException if the JSON string is invalid with respect to Schedule + */ + public static Schedule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Schedule.class); + } + + /** + * Convert an instance of Schedule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/SettingsOverride.java b/src/main/java/org/openapitools/client/model/SettingsOverride.java new file mode 100644 index 00000000..5580f36f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SettingsOverride.java @@ -0,0 +1,506 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApplicationFormAdditionalDisclosuresInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SettingsOverride + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SettingsOverride { + public static final String SERIALIZED_NAME_REDIRECT_URL = "redirectUrl"; + @SerializedName(SERIALIZED_NAME_REDIRECT_URL) + private String redirectUrl; + + public static final String SERIALIZED_NAME_PRIVACY_POLICY_URL = "privacyPolicyUrl"; + @SerializedName(SERIALIZED_NAME_PRIVACY_POLICY_URL) + private String privacyPolicyUrl; + + public static final String SERIALIZED_NAME_ELECTRONIC_DISCLOSURES_URL = "electronicDisclosuresUrl"; + @SerializedName(SERIALIZED_NAME_ELECTRONIC_DISCLOSURES_URL) + private String electronicDisclosuresUrl; + + public static final String SERIALIZED_NAME_DEPOSIT_TERMS_URL = "depositTermsUrl"; + @SerializedName(SERIALIZED_NAME_DEPOSIT_TERMS_URL) + private String depositTermsUrl; + + public static final String SERIALIZED_NAME_CLIENT_TERMS_URL = "clientTermsUrl"; + @SerializedName(SERIALIZED_NAME_CLIENT_TERMS_URL) + private String clientTermsUrl; + + public static final String SERIALIZED_NAME_CARDHOLDER_TERMS_URL = "cardholderTermsUrl"; + @SerializedName(SERIALIZED_NAME_CARDHOLDER_TERMS_URL) + private String cardholderTermsUrl; + + public static final String SERIALIZED_NAME_CASH_ADVANCED_TERMS_URL = "cashAdvancedTermsUrl"; + @SerializedName(SERIALIZED_NAME_CASH_ADVANCED_TERMS_URL) + private String cashAdvancedTermsUrl; + + public static final String SERIALIZED_NAME_DEBIT_CARD_DISCLOSURE_URL = "debitCardDisclosureUrl"; + @SerializedName(SERIALIZED_NAME_DEBIT_CARD_DISCLOSURE_URL) + private String debitCardDisclosureUrl; + + public static final String SERIALIZED_NAME_ADDITIONAL_DISCLOSURES = "additionalDisclosures"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_DISCLOSURES) + private List additionalDisclosures; + + public static final String SERIALIZED_NAME_VALIDATE_PHONE_NUMBER = "validatePhoneNumber"; + @SerializedName(SERIALIZED_NAME_VALIDATE_PHONE_NUMBER) + private Boolean validatePhoneNumber = true; + + public SettingsOverride() { + } + + public SettingsOverride redirectUrl(String redirectUrl) { + + this.redirectUrl = redirectUrl; + return this; + } + + /** + * Get redirectUrl + * @return redirectUrl + **/ + @javax.annotation.Nullable + public String getRedirectUrl() { + return redirectUrl; + } + + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + + public SettingsOverride privacyPolicyUrl(String privacyPolicyUrl) { + + this.privacyPolicyUrl = privacyPolicyUrl; + return this; + } + + /** + * Get privacyPolicyUrl + * @return privacyPolicyUrl + **/ + @javax.annotation.Nullable + public String getPrivacyPolicyUrl() { + return privacyPolicyUrl; + } + + + public void setPrivacyPolicyUrl(String privacyPolicyUrl) { + this.privacyPolicyUrl = privacyPolicyUrl; + } + + + public SettingsOverride electronicDisclosuresUrl(String electronicDisclosuresUrl) { + + this.electronicDisclosuresUrl = electronicDisclosuresUrl; + return this; + } + + /** + * Get electronicDisclosuresUrl + * @return electronicDisclosuresUrl + **/ + @javax.annotation.Nullable + public String getElectronicDisclosuresUrl() { + return electronicDisclosuresUrl; + } + + + public void setElectronicDisclosuresUrl(String electronicDisclosuresUrl) { + this.electronicDisclosuresUrl = electronicDisclosuresUrl; + } + + + public SettingsOverride depositTermsUrl(String depositTermsUrl) { + + this.depositTermsUrl = depositTermsUrl; + return this; + } + + /** + * Get depositTermsUrl + * @return depositTermsUrl + **/ + @javax.annotation.Nullable + public String getDepositTermsUrl() { + return depositTermsUrl; + } + + + public void setDepositTermsUrl(String depositTermsUrl) { + this.depositTermsUrl = depositTermsUrl; + } + + + public SettingsOverride clientTermsUrl(String clientTermsUrl) { + + this.clientTermsUrl = clientTermsUrl; + return this; + } + + /** + * Get clientTermsUrl + * @return clientTermsUrl + **/ + @javax.annotation.Nullable + public String getClientTermsUrl() { + return clientTermsUrl; + } + + + public void setClientTermsUrl(String clientTermsUrl) { + this.clientTermsUrl = clientTermsUrl; + } + + + public SettingsOverride cardholderTermsUrl(String cardholderTermsUrl) { + + this.cardholderTermsUrl = cardholderTermsUrl; + return this; + } + + /** + * Get cardholderTermsUrl + * @return cardholderTermsUrl + **/ + @javax.annotation.Nullable + public String getCardholderTermsUrl() { + return cardholderTermsUrl; + } + + + public void setCardholderTermsUrl(String cardholderTermsUrl) { + this.cardholderTermsUrl = cardholderTermsUrl; + } + + + public SettingsOverride cashAdvancedTermsUrl(String cashAdvancedTermsUrl) { + + this.cashAdvancedTermsUrl = cashAdvancedTermsUrl; + return this; + } + + /** + * Get cashAdvancedTermsUrl + * @return cashAdvancedTermsUrl + **/ + @javax.annotation.Nullable + public String getCashAdvancedTermsUrl() { + return cashAdvancedTermsUrl; + } + + + public void setCashAdvancedTermsUrl(String cashAdvancedTermsUrl) { + this.cashAdvancedTermsUrl = cashAdvancedTermsUrl; + } + + + public SettingsOverride debitCardDisclosureUrl(String debitCardDisclosureUrl) { + + this.debitCardDisclosureUrl = debitCardDisclosureUrl; + return this; + } + + /** + * Get debitCardDisclosureUrl + * @return debitCardDisclosureUrl + **/ + @javax.annotation.Nullable + public String getDebitCardDisclosureUrl() { + return debitCardDisclosureUrl; + } + + + public void setDebitCardDisclosureUrl(String debitCardDisclosureUrl) { + this.debitCardDisclosureUrl = debitCardDisclosureUrl; + } + + + public SettingsOverride additionalDisclosures(List additionalDisclosures) { + + this.additionalDisclosures = additionalDisclosures; + return this; + } + + public SettingsOverride addAdditionalDisclosuresItem(ApplicationFormAdditionalDisclosuresInner additionalDisclosuresItem) { + if (this.additionalDisclosures == null) { + this.additionalDisclosures = new ArrayList<>(); + } + this.additionalDisclosures.add(additionalDisclosuresItem); + return this; + } + + /** + * Get additionalDisclosures + * @return additionalDisclosures + **/ + @javax.annotation.Nullable + public List getAdditionalDisclosures() { + return additionalDisclosures; + } + + + public void setAdditionalDisclosures(List additionalDisclosures) { + this.additionalDisclosures = additionalDisclosures; + } + + + public SettingsOverride validatePhoneNumber(Boolean validatePhoneNumber) { + + this.validatePhoneNumber = validatePhoneNumber; + return this; + } + + /** + * Get validatePhoneNumber + * @return validatePhoneNumber + **/ + @javax.annotation.Nullable + public Boolean getValidatePhoneNumber() { + return validatePhoneNumber; + } + + + public void setValidatePhoneNumber(Boolean validatePhoneNumber) { + this.validatePhoneNumber = validatePhoneNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingsOverride settingsOverride = (SettingsOverride) o; + return Objects.equals(this.redirectUrl, settingsOverride.redirectUrl) && + Objects.equals(this.privacyPolicyUrl, settingsOverride.privacyPolicyUrl) && + Objects.equals(this.electronicDisclosuresUrl, settingsOverride.electronicDisclosuresUrl) && + Objects.equals(this.depositTermsUrl, settingsOverride.depositTermsUrl) && + Objects.equals(this.clientTermsUrl, settingsOverride.clientTermsUrl) && + Objects.equals(this.cardholderTermsUrl, settingsOverride.cardholderTermsUrl) && + Objects.equals(this.cashAdvancedTermsUrl, settingsOverride.cashAdvancedTermsUrl) && + Objects.equals(this.debitCardDisclosureUrl, settingsOverride.debitCardDisclosureUrl) && + Objects.equals(this.additionalDisclosures, settingsOverride.additionalDisclosures) && + Objects.equals(this.validatePhoneNumber, settingsOverride.validatePhoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(redirectUrl, privacyPolicyUrl, electronicDisclosuresUrl, depositTermsUrl, clientTermsUrl, cardholderTermsUrl, cashAdvancedTermsUrl, debitCardDisclosureUrl, additionalDisclosures, validatePhoneNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingsOverride {\n"); + sb.append(" redirectUrl: ").append(toIndentedString(redirectUrl)).append("\n"); + sb.append(" privacyPolicyUrl: ").append(toIndentedString(privacyPolicyUrl)).append("\n"); + sb.append(" electronicDisclosuresUrl: ").append(toIndentedString(electronicDisclosuresUrl)).append("\n"); + sb.append(" depositTermsUrl: ").append(toIndentedString(depositTermsUrl)).append("\n"); + sb.append(" clientTermsUrl: ").append(toIndentedString(clientTermsUrl)).append("\n"); + sb.append(" cardholderTermsUrl: ").append(toIndentedString(cardholderTermsUrl)).append("\n"); + sb.append(" cashAdvancedTermsUrl: ").append(toIndentedString(cashAdvancedTermsUrl)).append("\n"); + sb.append(" debitCardDisclosureUrl: ").append(toIndentedString(debitCardDisclosureUrl)).append("\n"); + sb.append(" additionalDisclosures: ").append(toIndentedString(additionalDisclosures)).append("\n"); + sb.append(" validatePhoneNumber: ").append(toIndentedString(validatePhoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("redirectUrl"); + openapiFields.add("privacyPolicyUrl"); + openapiFields.add("electronicDisclosuresUrl"); + openapiFields.add("depositTermsUrl"); + openapiFields.add("clientTermsUrl"); + openapiFields.add("cardholderTermsUrl"); + openapiFields.add("cashAdvancedTermsUrl"); + openapiFields.add("debitCardDisclosureUrl"); + openapiFields.add("additionalDisclosures"); + openapiFields.add("validatePhoneNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettingsOverride + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettingsOverride.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettingsOverride is not found in the empty JSON string", SettingsOverride.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SettingsOverride.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SettingsOverride` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("redirectUrl") != null && !jsonObj.get("redirectUrl").isJsonNull()) && !jsonObj.get("redirectUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectUrl").toString())); + } + if ((jsonObj.get("privacyPolicyUrl") != null && !jsonObj.get("privacyPolicyUrl").isJsonNull()) && !jsonObj.get("privacyPolicyUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `privacyPolicyUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("privacyPolicyUrl").toString())); + } + if ((jsonObj.get("electronicDisclosuresUrl") != null && !jsonObj.get("electronicDisclosuresUrl").isJsonNull()) && !jsonObj.get("electronicDisclosuresUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `electronicDisclosuresUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("electronicDisclosuresUrl").toString())); + } + if ((jsonObj.get("depositTermsUrl") != null && !jsonObj.get("depositTermsUrl").isJsonNull()) && !jsonObj.get("depositTermsUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `depositTermsUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("depositTermsUrl").toString())); + } + if ((jsonObj.get("clientTermsUrl") != null && !jsonObj.get("clientTermsUrl").isJsonNull()) && !jsonObj.get("clientTermsUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clientTermsUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clientTermsUrl").toString())); + } + if ((jsonObj.get("cardholderTermsUrl") != null && !jsonObj.get("cardholderTermsUrl").isJsonNull()) && !jsonObj.get("cardholderTermsUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cardholderTermsUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cardholderTermsUrl").toString())); + } + if ((jsonObj.get("cashAdvancedTermsUrl") != null && !jsonObj.get("cashAdvancedTermsUrl").isJsonNull()) && !jsonObj.get("cashAdvancedTermsUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cashAdvancedTermsUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cashAdvancedTermsUrl").toString())); + } + if ((jsonObj.get("debitCardDisclosureUrl") != null && !jsonObj.get("debitCardDisclosureUrl").isJsonNull()) && !jsonObj.get("debitCardDisclosureUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `debitCardDisclosureUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("debitCardDisclosureUrl").toString())); + } + if (jsonObj.get("additionalDisclosures") != null && !jsonObj.get("additionalDisclosures").isJsonNull()) { + JsonArray jsonArrayadditionalDisclosures = jsonObj.getAsJsonArray("additionalDisclosures"); + if (jsonArrayadditionalDisclosures != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalDisclosures").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalDisclosures` to be an array in the JSON string but got `%s`", jsonObj.get("additionalDisclosures").toString())); + } + + // validate the optional field `additionalDisclosures` (array) + for (int i = 0; i < jsonArrayadditionalDisclosures.size(); i++) { + ApplicationFormAdditionalDisclosuresInner.validateJsonElement(jsonArrayadditionalDisclosures.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettingsOverride.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettingsOverride' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettingsOverride.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettingsOverride value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettingsOverride read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SettingsOverride given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettingsOverride + * @throws IOException if the JSON string is invalid with respect to SettingsOverride + */ + public static SettingsOverride fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettingsOverride.class); + } + + /** + * Convert an instance of SettingsOverride to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/SettlementTransaction.java b/src/main/java/org/openapitools/client/model/SettlementTransaction.java new file mode 100644 index 00000000..1b4a7b81 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SettlementTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SettlementTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SettlementTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public SettlementTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public SettlementTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public SettlementTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettlementTransaction settlementTransaction = (SettlementTransaction) o; + return Objects.equals(this.attributes, settlementTransaction.attributes) && + Objects.equals(this.relationships, settlementTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettlementTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettlementTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettlementTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettlementTransaction is not found in the empty JSON string", SettlementTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SettlementTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SettlementTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SettlementTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettlementTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettlementTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettlementTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettlementTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SettlementTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SettlementTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettlementTransaction + * @throws IOException if the JSON string is invalid with respect to SettlementTransaction + */ + public static SettlementTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettlementTransaction.class); + } + + /** + * Convert an instance of SettlementTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/SoleProprietorshipAnnualRevenue.java b/src/main/java/org/openapitools/client/model/SoleProprietorshipAnnualRevenue.java new file mode 100644 index 00000000..2e4dc1d4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SoleProprietorshipAnnualRevenue.java @@ -0,0 +1,78 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets soleProprietorshipAnnualRevenue + */ +@JsonAdapter(SoleProprietorshipAnnualRevenue.Adapter.class) +public enum SoleProprietorshipAnnualRevenue { + + UPTO50K("UpTo50k"), + + BETWEEN50KAND100K("Between50kAnd100k"), + + BETWEEN100KAND200K("Between100kAnd200k"), + + BETWEEN200KAND500K("Between200kAnd500k"), + + OVER500K("Over500k"); + + private String value; + + SoleProprietorshipAnnualRevenue(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SoleProprietorshipAnnualRevenue fromValue(String value) { + for (SoleProprietorshipAnnualRevenue b : SoleProprietorshipAnnualRevenue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SoleProprietorshipAnnualRevenue enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SoleProprietorshipAnnualRevenue read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SoleProprietorshipAnnualRevenue.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/SoleProprietorshipNumberOfEmployees.java b/src/main/java/org/openapitools/client/model/SoleProprietorshipNumberOfEmployees.java new file mode 100644 index 00000000..b668b57e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SoleProprietorshipNumberOfEmployees.java @@ -0,0 +1,76 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets soleProprietorshipNumberOfEmployees + */ +@JsonAdapter(SoleProprietorshipNumberOfEmployees.Adapter.class) +public enum SoleProprietorshipNumberOfEmployees { + + ONE("One"), + + BETWEEN2AND5("Between2And5"), + + BETWEEN5AND10("Between5And10"), + + OVER10("Over10"); + + private String value; + + SoleProprietorshipNumberOfEmployees(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SoleProprietorshipNumberOfEmployees fromValue(String value) { + for (SoleProprietorshipNumberOfEmployees b : SoleProprietorshipNumberOfEmployees.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SoleProprietorshipNumberOfEmployees enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SoleProprietorshipNumberOfEmployees read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SoleProprietorshipNumberOfEmployees.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/SourceOfFunds.java b/src/main/java/org/openapitools/client/model/SourceOfFunds.java new file mode 100644 index 00000000..965ceb54 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SourceOfFunds.java @@ -0,0 +1,78 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets sourceOfFunds + */ +@JsonAdapter(SourceOfFunds.Adapter.class) +public enum SourceOfFunds { + + INHERITANCE("Inheritance"), + + SALARY("Salary"), + + SAVINGS("Savings"), + + INVESTMENTRETURNS("InvestmentReturns"), + + GIFTS("Gifts"); + + private String value; + + SourceOfFunds(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceOfFunds fromValue(String value) { + for (SourceOfFunds b : SourceOfFunds.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SourceOfFunds enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceOfFunds read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceOfFunds.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/SourceOfIncome.java b/src/main/java/org/openapitools/client/model/SourceOfIncome.java new file mode 100644 index 00000000..8f4007d6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SourceOfIncome.java @@ -0,0 +1,80 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets sourceOfIncome + */ +@JsonAdapter(SourceOfIncome.Adapter.class) +public enum SourceOfIncome { + + EMPLOYMENTORPAYROLLINCOME("EmploymentOrPayrollIncome"), + + PARTTIMEORCONTRACTORINCOME("PartTimeOrContractorIncome"), + + INHERITANCESANDGIFTS("InheritancesAndGifts"), + + PERSONALINVESTMENTS("PersonalInvestments"), + + BUSINESSOWNERSHIPINTERESTS("BusinessOwnershipInterests"), + + GOVERNMENTBENEFITS("GovernmentBenefits"); + + private String value; + + SourceOfIncome(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceOfIncome fromValue(String value) { + for (SourceOfIncome b : SourceOfIncome.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SourceOfIncome enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceOfIncome read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceOfIncome.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/SponsoredInterestTransaction.java b/src/main/java/org/openapitools/client/model/SponsoredInterestTransaction.java new file mode 100644 index 00000000..80399e4a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/SponsoredInterestTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositTransactionAllOfAttributes; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SponsoredInterestTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SponsoredInterestTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private CheckDepositTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public SponsoredInterestTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public SponsoredInterestTransaction attributes(CheckDepositTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public CheckDepositTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(CheckDepositTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public SponsoredInterestTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SponsoredInterestTransaction sponsoredInterestTransaction = (SponsoredInterestTransaction) o; + return Objects.equals(this.attributes, sponsoredInterestTransaction.attributes) && + Objects.equals(this.relationships, sponsoredInterestTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SponsoredInterestTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SponsoredInterestTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SponsoredInterestTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SponsoredInterestTransaction is not found in the empty JSON string", SponsoredInterestTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SponsoredInterestTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SponsoredInterestTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SponsoredInterestTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SponsoredInterestTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SponsoredInterestTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SponsoredInterestTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SponsoredInterestTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SponsoredInterestTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SponsoredInterestTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of SponsoredInterestTransaction + * @throws IOException if the JSON string is invalid with respect to SponsoredInterestTransaction + */ + public static SponsoredInterestTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SponsoredInterestTransaction.class); + } + + /** + * Convert an instance of SponsoredInterestTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Statement.java b/src/main/java/org/openapitools/client/model/Statement.java new file mode 100644 index 00000000..920eec8f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Statement.java @@ -0,0 +1,312 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.StatementAttributes; +import org.openapitools.client.model.StatementRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Statement + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Statement { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private StatementAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private StatementRelationships relationships; + + public Statement() { + } + + public Statement type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Statement id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Statement attributes(StatementAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public StatementAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(StatementAttributes attributes) { + this.attributes = attributes; + } + + + public Statement relationships(StatementRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public StatementRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(StatementRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Statement statement = (Statement) o; + return Objects.equals(this.type, statement.type) && + Objects.equals(this.id, statement.id) && + Objects.equals(this.attributes, statement.attributes) && + Objects.equals(this.relationships, statement.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Statement {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Statement + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Statement.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Statement is not found in the empty JSON string", Statement.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Statement.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Statement` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Statement.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + StatementAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + StatementRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Statement.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Statement' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Statement.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Statement value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Statement read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Statement given an JSON string + * + * @param jsonString JSON string + * @return An instance of Statement + * @throws IOException if the JSON string is invalid with respect to Statement + */ + public static Statement fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Statement.class); + } + + /** + * Convert an instance of Statement to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StatementAttributes.java b/src/main/java/org/openapitools/client/model/StatementAttributes.java new file mode 100644 index 00000000..006fb8a8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StatementAttributes.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StatementAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StatementAttributes { + public static final String SERIALIZED_NAME_PERIOD = "period"; + @SerializedName(SERIALIZED_NAME_PERIOD) + private String period; + + public StatementAttributes() { + } + + public StatementAttributes period(String period) { + + this.period = period; + return this; + } + + /** + * Get period + * @return period + **/ + @javax.annotation.Nullable + public String getPeriod() { + return period; + } + + + public void setPeriod(String period) { + this.period = period; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatementAttributes statementAttributes = (StatementAttributes) o; + return Objects.equals(this.period, statementAttributes.period); + } + + @Override + public int hashCode() { + return Objects.hash(period); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatementAttributes {\n"); + sb.append(" period: ").append(toIndentedString(period)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("period"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StatementAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StatementAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatementAttributes is not found in the empty JSON string", StatementAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StatementAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StatementAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("period") != null && !jsonObj.get("period").isJsonNull()) && !jsonObj.get("period").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `period` to be a primitive type in the JSON string but got `%s`", jsonObj.get("period").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StatementAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatementAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatementAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StatementAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StatementAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StatementAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of StatementAttributes + * @throws IOException if the JSON string is invalid with respect to StatementAttributes + */ + public static StatementAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatementAttributes.class); + } + + /** + * Convert an instance of StatementAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StatementRelationships.java b/src/main/java/org/openapitools/client/model/StatementRelationships.java new file mode 100644 index 00000000..b66addcc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StatementRelationships.java @@ -0,0 +1,275 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomersRelationship; +import org.openapitools.client.model.Relationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StatementRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StatementRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Relationship account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private Relationship customer; + + public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; + @SerializedName(SERIALIZED_NAME_CUSTOMERS) + private CustomersRelationship customers; + + public StatementRelationships() { + } + + public StatementRelationships account(Relationship account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + public Relationship getAccount() { + return account; + } + + + public void setAccount(Relationship account) { + this.account = account; + } + + + public StatementRelationships customer(Relationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public Relationship getCustomer() { + return customer; + } + + + public void setCustomer(Relationship customer) { + this.customer = customer; + } + + + public StatementRelationships customers(CustomersRelationship customers) { + + this.customers = customers; + return this; + } + + /** + * Get customers + * @return customers + **/ + @javax.annotation.Nullable + public CustomersRelationship getCustomers() { + return customers; + } + + + public void setCustomers(CustomersRelationship customers) { + this.customers = customers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatementRelationships statementRelationships = (StatementRelationships) o; + return Objects.equals(this.account, statementRelationships.account) && + Objects.equals(this.customer, statementRelationships.customer) && + Objects.equals(this.customers, statementRelationships.customers); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer, customers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatementRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("customers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StatementRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StatementRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatementRelationships is not found in the empty JSON string", StatementRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StatementRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StatementRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("account")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + Relationship.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `customers` + if (jsonObj.get("customers") != null && !jsonObj.get("customers").isJsonNull()) { + CustomersRelationship.validateJsonElement(jsonObj.get("customers")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StatementRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatementRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatementRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StatementRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StatementRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StatementRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of StatementRelationships + * @throws IOException if the JSON string is invalid with respect to StatementRelationships + */ + public static StatementRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatementRelationships.class); + } + + /** + * Convert an instance of StatementRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StatusEvent.java b/src/main/java/org/openapitools/client/model/StatusEvent.java new file mode 100644 index 00000000..4d1c447d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StatusEvent.java @@ -0,0 +1,278 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.StatusEventStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StatusEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StatusEvent { + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private String updatedAt; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updatedBy"; + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + private String updatedBy; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEventStatus status; + + public StatusEvent() { + } + + public StatusEvent updatedAt(String updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + + public StatusEvent updatedBy(String updatedBy) { + + this.updatedBy = updatedBy; + return this; + } + + /** + * Get updatedBy + * @return updatedBy + **/ + @javax.annotation.Nullable + public String getUpdatedBy() { + return updatedBy; + } + + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + + public StatusEvent status(StatusEventStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEventStatus getStatus() { + return status; + } + + + public void setStatus(StatusEventStatus status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatusEvent statusEvent = (StatusEvent) o; + return Objects.equals(this.updatedAt, statusEvent.updatedAt) && + Objects.equals(this.updatedBy, statusEvent.updatedBy) && + Objects.equals(this.status, statusEvent.status); + } + + @Override + public int hashCode() { + return Objects.hash(updatedAt, updatedBy, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatusEvent {\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("updatedAt"); + openapiFields.add("updatedBy"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StatusEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StatusEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatusEvent is not found in the empty JSON string", StatusEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StatusEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StatusEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StatusEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("updatedAt") != null && !jsonObj.get("updatedAt").isJsonNull()) && !jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + if ((jsonObj.get("updatedBy") != null && !jsonObj.get("updatedBy").isJsonNull()) && !jsonObj.get("updatedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedBy").toString())); + } + // validate the required field `status` + StatusEventStatus.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StatusEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatusEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatusEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StatusEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StatusEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StatusEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of StatusEvent + * @throws IOException if the JSON string is invalid with respect to StatusEvent + */ + public static StatusEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatusEvent.class); + } + + /** + * Convert an instance of StatusEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StatusEventStatus.java b/src/main/java/org/openapitools/client/model/StatusEventStatus.java new file mode 100644 index 00000000..488a4f4c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StatusEventStatus.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDepositStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StatusEventStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StatusEventStatus { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private CheckDepositStatus type; + + public StatusEventStatus() { + } + + public StatusEventStatus type(CheckDepositStatus type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public CheckDepositStatus getType() { + return type; + } + + + public void setType(CheckDepositStatus type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StatusEventStatus statusEventStatus = (StatusEventStatus) o; + return Objects.equals(this.type, statusEventStatus.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatusEventStatus {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StatusEventStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StatusEventStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatusEventStatus is not found in the empty JSON string", StatusEventStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StatusEventStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StatusEventStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StatusEventStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatusEventStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatusEventStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StatusEventStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StatusEventStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StatusEventStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of StatusEventStatus + * @throws IOException if the JSON string is invalid with respect to StatusEventStatus + */ + public static StatusEventStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatusEventStatus.class); + } + + /** + * Convert an instance of StatusEventStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPayment.java b/src/main/java/org/openapitools/client/model/StopPayment.java new file mode 100644 index 00000000..35561dbc --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPayment.java @@ -0,0 +1,312 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.StopPaymentAttributes; +import org.openapitools.client.model.StopPaymentRelationships; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPayment { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "stopPayment"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private StopPaymentAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private StopPaymentRelationships relationships; + + public StopPayment() { + } + + public StopPayment type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public StopPayment id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public StopPayment attributes(StopPaymentAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public StopPaymentAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(StopPaymentAttributes attributes) { + this.attributes = attributes; + } + + + public StopPayment relationships(StopPaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public StopPaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(StopPaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPayment stopPayment = (StopPayment) o; + return Objects.equals(this.type, stopPayment.type) && + Objects.equals(this.id, stopPayment.id) && + Objects.equals(this.attributes, stopPayment.attributes) && + Objects.equals(this.relationships, stopPayment.relationships); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes, relationships); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPayment {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPayment is not found in the empty JSON string", StopPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StopPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + StopPaymentAttributes.validateJsonElement(jsonObj.get("attributes")); + // validate the required field `relationships` + StopPaymentRelationships.validateJsonElement(jsonObj.get("relationships")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPayment + * @throws IOException if the JSON string is invalid with respect to StopPayment + */ + public static StopPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPayment.class); + } + + /** + * Convert an instance of StopPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentAttributes.java b/src/main/java/org/openapitools/client/model/StopPaymentAttributes.java new file mode 100644 index 00000000..6d38f27d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentAttributes.java @@ -0,0 +1,411 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("Active"), + + DISABLED("Disabled"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_CHECK_NUMBER = "checkNumber"; + @SerializedName(SERIALIZED_NAME_CHECK_NUMBER) + private String checkNumber; + + public StopPaymentAttributes() { + } + + public StopPaymentAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public StopPaymentAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public StopPaymentAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public StopPaymentAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public StopPaymentAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public StopPaymentAttributes checkNumber(String checkNumber) { + + this.checkNumber = checkNumber; + return this; + } + + /** + * Get checkNumber + * @return checkNumber + **/ + @javax.annotation.Nonnull + public String getCheckNumber() { + return checkNumber; + } + + + public void setCheckNumber(String checkNumber) { + this.checkNumber = checkNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentAttributes stopPaymentAttributes = (StopPaymentAttributes) o; + return Objects.equals(this.createdAt, stopPaymentAttributes.createdAt) && + Objects.equals(this.updatedAt, stopPaymentAttributes.updatedAt) && + Objects.equals(this.amount, stopPaymentAttributes.amount) && + Objects.equals(this.status, stopPaymentAttributes.status) && + Objects.equals(this.tags, stopPaymentAttributes.tags) && + Objects.equals(this.checkNumber, stopPaymentAttributes.checkNumber); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, amount, status, tags, checkNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" checkNumber: ").append(toIndentedString(checkNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("amount"); + openapiFields.add("status"); + openapiFields.add("tags"); + openapiFields.add("checkNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("checkNumber"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentAttributes is not found in the empty JSON string", StopPaymentAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StopPaymentAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (!jsonObj.get("checkNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `checkNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("checkNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentAttributes + * @throws IOException if the JSON string is invalid with respect to StopPaymentAttributes + */ + public static StopPaymentAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentAttributes.class); + } + + /** + * Convert an instance of StopPaymentAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentListResponse.java b/src/main/java/org/openapitools/client/model/StopPaymentListResponse.java new file mode 100644 index 00000000..623a0819 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentListResponse.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.StopPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public StopPaymentListResponse() { + } + + public StopPaymentListResponse data(List data) { + + this.data = data; + return this; + } + + public StopPaymentListResponse addDataItem(StopPayment dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentListResponse stopPaymentListResponse = (StopPaymentListResponse) o; + return Objects.equals(this.data, stopPaymentListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentListResponse is not found in the empty JSON string", StopPaymentListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + StopPayment.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentListResponse + * @throws IOException if the JSON string is invalid with respect to StopPaymentListResponse + */ + public static StopPaymentListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentListResponse.class); + } + + /** + * Convert an instance of StopPaymentListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentRelationships.java b/src/main/java/org/openapitools/client/model/StopPaymentRelationships.java new file mode 100644 index 00000000..95c73250 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentRelationships.java @@ -0,0 +1,314 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomersRelationship; +import org.openapitools.client.model.ReceivedPaymentRelationshipsCustomer; +import org.openapitools.client.model.RecurringAchPaymentRelationshipsAccount; +import org.openapitools.client.model.StopPaymentRelationshipsCheckPayments; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private RecurringAchPaymentRelationshipsAccount account; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private ReceivedPaymentRelationshipsCustomer customer; + + public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; + @SerializedName(SERIALIZED_NAME_CUSTOMERS) + private CustomersRelationship customers; + + public static final String SERIALIZED_NAME_CHECK_PAYMENTS = "checkPayments"; + @SerializedName(SERIALIZED_NAME_CHECK_PAYMENTS) + private StopPaymentRelationshipsCheckPayments checkPayments; + + public StopPaymentRelationships() { + } + + public StopPaymentRelationships account(RecurringAchPaymentRelationshipsAccount account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public RecurringAchPaymentRelationshipsAccount getAccount() { + return account; + } + + + public void setAccount(RecurringAchPaymentRelationshipsAccount account) { + this.account = account; + } + + + public StopPaymentRelationships customer(ReceivedPaymentRelationshipsCustomer customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsCustomer getCustomer() { + return customer; + } + + + public void setCustomer(ReceivedPaymentRelationshipsCustomer customer) { + this.customer = customer; + } + + + public StopPaymentRelationships customers(CustomersRelationship customers) { + + this.customers = customers; + return this; + } + + /** + * Get customers + * @return customers + **/ + @javax.annotation.Nullable + public CustomersRelationship getCustomers() { + return customers; + } + + + public void setCustomers(CustomersRelationship customers) { + this.customers = customers; + } + + + public StopPaymentRelationships checkPayments(StopPaymentRelationshipsCheckPayments checkPayments) { + + this.checkPayments = checkPayments; + return this; + } + + /** + * Get checkPayments + * @return checkPayments + **/ + @javax.annotation.Nullable + public StopPaymentRelationshipsCheckPayments getCheckPayments() { + return checkPayments; + } + + + public void setCheckPayments(StopPaymentRelationshipsCheckPayments checkPayments) { + this.checkPayments = checkPayments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentRelationships stopPaymentRelationships = (StopPaymentRelationships) o; + return Objects.equals(this.account, stopPaymentRelationships.account) && + Objects.equals(this.customer, stopPaymentRelationships.customer) && + Objects.equals(this.customers, stopPaymentRelationships.customers) && + Objects.equals(this.checkPayments, stopPaymentRelationships.checkPayments); + } + + @Override + public int hashCode() { + return Objects.hash(account, customer, customers, checkPayments); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append(" checkPayments: ").append(toIndentedString(checkPayments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("customer"); + openapiFields.add("customers"); + openapiFields.add("checkPayments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + openapiRequiredFields.add("customer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentRelationships is not found in the empty JSON string", StopPaymentRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StopPaymentRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + RecurringAchPaymentRelationshipsAccount.validateJsonElement(jsonObj.get("account")); + // validate the required field `customer` + ReceivedPaymentRelationshipsCustomer.validateJsonElement(jsonObj.get("customer")); + // validate the optional field `customers` + if (jsonObj.get("customers") != null && !jsonObj.get("customers").isJsonNull()) { + CustomersRelationship.validateJsonElement(jsonObj.get("customers")); + } + // validate the optional field `checkPayments` + if (jsonObj.get("checkPayments") != null && !jsonObj.get("checkPayments").isJsonNull()) { + StopPaymentRelationshipsCheckPayments.validateJsonElement(jsonObj.get("checkPayments")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentRelationships + * @throws IOException if the JSON string is invalid with respect to StopPaymentRelationships + */ + public static StopPaymentRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentRelationships.class); + } + + /** + * Convert an instance of StopPaymentRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentRelationshipsCheckPayments.java b/src/main/java/org/openapitools/client/model/StopPaymentRelationshipsCheckPayments.java new file mode 100644 index 00000000..c3895d62 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentRelationshipsCheckPayments.java @@ -0,0 +1,234 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.StopPaymentRelationshipsCheckPaymentsDataInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentRelationshipsCheckPayments + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentRelationshipsCheckPayments { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data = new ArrayList<>(); + + public StopPaymentRelationshipsCheckPayments() { + } + + public StopPaymentRelationshipsCheckPayments data(List data) { + + this.data = data; + return this; + } + + public StopPaymentRelationshipsCheckPayments addDataItem(StopPaymentRelationshipsCheckPaymentsDataInner dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentRelationshipsCheckPayments stopPaymentRelationshipsCheckPayments = (StopPaymentRelationshipsCheckPayments) o; + return Objects.equals(this.data, stopPaymentRelationshipsCheckPayments.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentRelationshipsCheckPayments {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentRelationshipsCheckPayments + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentRelationshipsCheckPayments.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentRelationshipsCheckPayments is not found in the empty JSON string", StopPaymentRelationshipsCheckPayments.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentRelationshipsCheckPayments.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentRelationshipsCheckPayments` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StopPaymentRelationshipsCheckPayments.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + StopPaymentRelationshipsCheckPaymentsDataInner.validateJsonElement(jsonArraydata.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentRelationshipsCheckPayments.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentRelationshipsCheckPayments' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentRelationshipsCheckPayments.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentRelationshipsCheckPayments value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentRelationshipsCheckPayments read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentRelationshipsCheckPayments given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentRelationshipsCheckPayments + * @throws IOException if the JSON string is invalid with respect to StopPaymentRelationshipsCheckPayments + */ + public static StopPaymentRelationshipsCheckPayments fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentRelationshipsCheckPayments.class); + } + + /** + * Convert an instance of StopPaymentRelationshipsCheckPayments to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentRelationshipsCheckPaymentsDataInner.java b/src/main/java/org/openapitools/client/model/StopPaymentRelationshipsCheckPaymentsDataInner.java new file mode 100644 index 00000000..093445b1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentRelationshipsCheckPaymentsDataInner.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentRelationshipsCheckPaymentsDataInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentRelationshipsCheckPaymentsDataInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "checkPayment"; + + public StopPaymentRelationshipsCheckPaymentsDataInner() { + } + + public StopPaymentRelationshipsCheckPaymentsDataInner id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public StopPaymentRelationshipsCheckPaymentsDataInner type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentRelationshipsCheckPaymentsDataInner stopPaymentRelationshipsCheckPaymentsDataInner = (StopPaymentRelationshipsCheckPaymentsDataInner) o; + return Objects.equals(this.id, stopPaymentRelationshipsCheckPaymentsDataInner.id) && + Objects.equals(this.type, stopPaymentRelationshipsCheckPaymentsDataInner.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentRelationshipsCheckPaymentsDataInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentRelationshipsCheckPaymentsDataInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentRelationshipsCheckPaymentsDataInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentRelationshipsCheckPaymentsDataInner is not found in the empty JSON string", StopPaymentRelationshipsCheckPaymentsDataInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentRelationshipsCheckPaymentsDataInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentRelationshipsCheckPaymentsDataInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentRelationshipsCheckPaymentsDataInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentRelationshipsCheckPaymentsDataInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentRelationshipsCheckPaymentsDataInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentRelationshipsCheckPaymentsDataInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentRelationshipsCheckPaymentsDataInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentRelationshipsCheckPaymentsDataInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentRelationshipsCheckPaymentsDataInner + * @throws IOException if the JSON string is invalid with respect to StopPaymentRelationshipsCheckPaymentsDataInner + */ + public static StopPaymentRelationshipsCheckPaymentsDataInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentRelationshipsCheckPaymentsDataInner.class); + } + + /** + * Convert an instance of StopPaymentRelationshipsCheckPaymentsDataInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentRequest.java b/src/main/java/org/openapitools/client/model/StopPaymentRequest.java new file mode 100644 index 00000000..233da428 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentRequest.java @@ -0,0 +1,277 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentRequest { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "account_id"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private BigDecimal amount; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public StopPaymentRequest() { + } + + public StopPaymentRequest accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nonnull + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public StopPaymentRequest amount(BigDecimal amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public BigDecimal getAmount() { + return amount; + } + + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + + public StopPaymentRequest description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentRequest stopPaymentRequest = (StopPaymentRequest) o; + return Objects.equals(this.accountId, stopPaymentRequest.accountId) && + Objects.equals(this.amount, stopPaymentRequest.amount) && + Objects.equals(this.description, stopPaymentRequest.description); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, amount, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentRequest {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account_id"); + openapiFields.add("amount"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account_id"); + openapiRequiredFields.add("amount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentRequest is not found in the empty JSON string", StopPaymentRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StopPaymentRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("account_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `account_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("account_id").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentRequest + * @throws IOException if the JSON string is invalid with respect to StopPaymentRequest + */ + public static StopPaymentRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentRequest.class); + } + + /** + * Convert an instance of StopPaymentRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/StopPaymentResponse.java b/src/main/java/org/openapitools/client/model/StopPaymentResponse.java new file mode 100644 index 00000000..72499e54 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/StopPaymentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.StopPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * StopPaymentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StopPaymentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private StopPayment data; + + public StopPaymentResponse() { + } + + public StopPaymentResponse data(StopPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public StopPayment getData() { + return data; + } + + + public void setData(StopPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopPaymentResponse stopPaymentResponse = (StopPaymentResponse) o; + return Objects.equals(this.data, stopPaymentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StopPaymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StopPaymentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StopPaymentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StopPaymentResponse is not found in the empty JSON string", StopPaymentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StopPaymentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StopPaymentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + StopPayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StopPaymentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StopPaymentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StopPaymentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StopPaymentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StopPaymentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StopPaymentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of StopPaymentResponse + * @throws IOException if the JSON string is invalid with respect to StopPaymentResponse + */ + public static StopPaymentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StopPaymentResponse.class); + } + + /** + * Convert an instance of StopPaymentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Transaction.java b/src/main/java/org/openapitools/client/model/Transaction.java new file mode 100644 index 00000000..6fbb1353 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Transaction.java @@ -0,0 +1,311 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Transaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Transaction { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + protected String type; + + public Transaction() { + this.type = this.getClass().getSimpleName(); + } + + public Transaction id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Transaction type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Transaction transaction = (Transaction) o; + return Objects.equals(this.id, transaction.id) && + Objects.equals(this.type, transaction.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transaction {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Transaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Transaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Transaction is not found in the empty JSON string", Transaction.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "accountLowBalanceClosureTransaction": + AccountLowBalanceClosureTransaction.validateJsonElement(jsonElement); + break; + case "adjustmentTransaction": + AdjustmentTransaction.validateJsonElement(jsonElement); + break; + case "atmTransaction": + AtmTransaction.validateJsonElement(jsonElement); + break; + case "bankRepaymentTransaction": + BankRepaymentTransaction.validateJsonElement(jsonElement); + break; + case "billPayTransaction": + BillPayTransaction.validateJsonElement(jsonElement); + break; + case "bookTransaction": + BookTransaction.validateJsonElement(jsonElement); + break; + case "cardTransaction": + CardTransaction.validateJsonElement(jsonElement); + break; + case "cashDepositTransaction": + CashDepositTransaction.validateJsonElement(jsonElement); + break; + case "chargebackTransaction": + ChargebackTransaction.validateJsonElement(jsonElement); + break; + case "checkDepositTransaction": + CheckDepositTransaction.validateJsonElement(jsonElement); + break; + case "checkPaymentTransaction": + CheckPaymentTransaction.validateJsonElement(jsonElement); + break; + case "customerRepaymentReturnedTransaction": + CustomerRepaymentReturnedTransaction.validateJsonElement(jsonElement); + break; + case "customerRepaymentTransaction": + CustomerRepaymentTransaction.validateJsonElement(jsonElement); + break; + case "dishonoredAchTransaction": + DishonoredAchTransaction.validateJsonElement(jsonElement); + break; + case "disputeSettlementTransaction": + DisputeSettlementTransaction.validateJsonElement(jsonElement); + break; + case "disputeTransaction": + DisputeTransaction.validateJsonElement(jsonElement); + break; + case "feeTransaction": + FeeTransaction.validateJsonElement(jsonElement); + break; + case "interchangeTransaction": + InterchangeTransaction.validateJsonElement(jsonElement); + break; + case "interestShareTransaction": + InterestShareTransaction.validateJsonElement(jsonElement); + break; + case "interestTransaction": + InterestTransaction.validateJsonElement(jsonElement); + break; + case "negativeBalanceCoverageTransaction": + NegativeBalanceCoverageTransaction.validateJsonElement(jsonElement); + break; + case "originatedAchTransaction": + OriginatedAchTransaction.validateJsonElement(jsonElement); + break; + case "paymentAdvanceTransaction": + PaymentAdvanceTransaction.validateJsonElement(jsonElement); + break; + case "purchaseTransaction": + PurchaseTransaction.validateJsonElement(jsonElement); + break; + case "receivedAchTransaction": + ReceivedAchTransaction.validateJsonElement(jsonElement); + break; + case "releaseTransaction": + ReleaseTransaction.validateJsonElement(jsonElement); + break; + case "repaidPaymentAdvanceTransaction": + RepaidPaymentAdvanceTransaction.validateJsonElement(jsonElement); + break; + case "returnedAchTransaction": + ReturnedAchTransaction.validateJsonElement(jsonElement); + break; + case "returnedCheckDepositTransaction": + ReturnedCheckDepositTransaction.validateJsonElement(jsonElement); + break; + case "returnedCheckPaymentTransaction": + ReturnedCheckPaymentTransaction.validateJsonElement(jsonElement); + break; + case "returnedReceivedAchTransaction": + ReturnedReceivedAchTransaction.validateJsonElement(jsonElement); + break; + case "reversalTransaction": + ReversalTransaction.validateJsonElement(jsonElement); + break; + case "rewardTransaction": + RewardTransaction.validateJsonElement(jsonElement); + break; + case "settlementTransaction": + SettlementTransaction.validateJsonElement(jsonElement); + break; + case "sponsoredInterestTransaction": + SponsoredInterestTransaction.validateJsonElement(jsonElement); + break; + case "wireTransaction": + WireTransaction.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Transaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of Transaction + * @throws IOException if the JSON string is invalid with respect to Transaction + */ + public static Transaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Transaction.class); + } + + /** + * Convert an instance of Transaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TransactionRelationship.java b/src/main/java/org/openapitools/client/model/TransactionRelationship.java new file mode 100644 index 00000000..d38d4001 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TransactionRelationship.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPaymentRelationshipsReceivePaymentTransactionData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TransactionRelationship + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TransactionRelationship { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPaymentRelationshipsReceivePaymentTransactionData data; + + public TransactionRelationship() { + } + + public TransactionRelationship data(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public ReceivedPaymentRelationshipsReceivePaymentTransactionData getData() { + return data; + } + + + public void setData(ReceivedPaymentRelationshipsReceivePaymentTransactionData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionRelationship transactionRelationship = (TransactionRelationship) o; + return Objects.equals(this.data, transactionRelationship.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransactionRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransactionRelationship + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransactionRelationship.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransactionRelationship is not found in the empty JSON string", TransactionRelationship.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TransactionRelationship.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TransactionRelationship` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TransactionRelationship.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + ReceivedPaymentRelationshipsReceivePaymentTransactionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransactionRelationship.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransactionRelationship' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransactionRelationship.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransactionRelationship value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TransactionRelationship read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransactionRelationship given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransactionRelationship + * @throws IOException if the JSON string is invalid with respect to TransactionRelationship + */ + public static TransactionRelationship fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransactionRelationship.class); + } + + /** + * Convert an instance of TransactionRelationship to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TransactionRelationships.java b/src/main/java/org/openapitools/client/model/TransactionRelationships.java new file mode 100644 index 00000000..c6c51327 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TransactionRelationships.java @@ -0,0 +1,941 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountRelationship2; +import org.openapitools.client.model.AuthorizationRelationship; +import org.openapitools.client.model.AuthorizationRequestRelationship; +import org.openapitools.client.model.CardRelationship; +import org.openapitools.client.model.ChargebackRelationship; +import org.openapitools.client.model.CheckDepositRelationship; +import org.openapitools.client.model.CheckPaymentRelationship; +import org.openapitools.client.model.CounterpartyAccountRelationship1; +import org.openapitools.client.model.CounterpartyCustomerRelationship; +import org.openapitools.client.model.CustomerRelationship; +import org.openapitools.client.model.CustomersRelationship; +import org.openapitools.client.model.IncomingAchRelationship; +import org.openapitools.client.model.OrgRelationship; +import org.openapitools.client.model.PaymentRelationship; +import org.openapitools.client.model.ReceivedPaymentRelationship; +import org.openapitools.client.model.ReceivingAccountRelationship; +import org.openapitools.client.model.RecurringPaymentRelationship; +import org.openapitools.client.model.RelatedTransaction; +import org.openapitools.client.model.RelatedTransactionRelationship; +import org.openapitools.client.model.RepaymentRelationship; +import org.openapitools.client.model.ReturnedRelationship; +import org.openapitools.client.model.RewardRelationship; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TransactionRelationships + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TransactionRelationships { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AccountRelationship2 account; + + public static final String SERIALIZED_NAME_RECEIVING_ACCOUNT = "receivingAccount"; + @SerializedName(SERIALIZED_NAME_RECEIVING_ACCOUNT) + private ReceivingAccountRelationship receivingAccount; + + public static final String SERIALIZED_NAME_CUSTOMER = "customer"; + @SerializedName(SERIALIZED_NAME_CUSTOMER) + private CustomerRelationship customer; + + public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; + @SerializedName(SERIALIZED_NAME_CUSTOMERS) + private CustomersRelationship customers; + + public static final String SERIALIZED_NAME_COUNTERPARTY_ACCOUNT = "counterpartyAccount"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_ACCOUNT) + private CounterpartyAccountRelationship1 counterpartyAccount; + + public static final String SERIALIZED_NAME_COUNTERPARTY_CUSTOMER = "counterpartyCustomer"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY_CUSTOMER) + private CounterpartyCustomerRelationship counterpartyCustomer; + + public static final String SERIALIZED_NAME_RELATED_TRANSACTION = "relatedTransaction"; + @SerializedName(SERIALIZED_NAME_RELATED_TRANSACTION) + private RelatedTransactionRelationship relatedTransaction; + + public static final String SERIALIZED_NAME_DISPUTED_TRANSACTION = "disputedTransaction"; + @SerializedName(SERIALIZED_NAME_DISPUTED_TRANSACTION) + private RelatedTransaction disputedTransaction; + + public static final String SERIALIZED_NAME_AUTHORIZATION = "authorization"; + @SerializedName(SERIALIZED_NAME_AUTHORIZATION) + private AuthorizationRelationship authorization; + + public static final String SERIALIZED_NAME_RETURNED = "returned"; + @SerializedName(SERIALIZED_NAME_RETURNED) + private ReturnedRelationship returned; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + private PaymentRelationship payment; + + public static final String SERIALIZED_NAME_CHECK_PAYMENT = "checkPayment"; + @SerializedName(SERIALIZED_NAME_CHECK_PAYMENT) + private CheckPaymentRelationship checkPayment; + + public static final String SERIALIZED_NAME_REPAYMENT = "repayment"; + @SerializedName(SERIALIZED_NAME_REPAYMENT) + private RepaymentRelationship repayment; + + public static final String SERIALIZED_NAME_RECURRING_PAYMENT = "recurringPayment"; + @SerializedName(SERIALIZED_NAME_RECURRING_PAYMENT) + private RecurringPaymentRelationship recurringPayment; + + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private OrgRelationship org; + + public static final String SERIALIZED_NAME_CARD = "card"; + @SerializedName(SERIALIZED_NAME_CARD) + private CardRelationship card; + + public static final String SERIALIZED_NAME_INCOMING_ACH = "incomingAch"; + @SerializedName(SERIALIZED_NAME_INCOMING_ACH) + private IncomingAchRelationship incomingAch; + + public static final String SERIALIZED_NAME_CHECK_DEPOSIT = "checkDeposit"; + @SerializedName(SERIALIZED_NAME_CHECK_DEPOSIT) + private CheckDepositRelationship checkDeposit; + + public static final String SERIALIZED_NAME_AUTHORIZATION_REQUEST = "authorizationRequest"; + @SerializedName(SERIALIZED_NAME_AUTHORIZATION_REQUEST) + private AuthorizationRequestRelationship authorizationRequest; + + public static final String SERIALIZED_NAME_PAYMENT_ADVANCE_TRANSACTION = "paymentAdvanceTransaction"; + @SerializedName(SERIALIZED_NAME_PAYMENT_ADVANCE_TRANSACTION) + private RelatedTransaction paymentAdvanceTransaction; + + public static final String SERIALIZED_NAME_RECEIVED_PAYMENT = "receivedPayment"; + @SerializedName(SERIALIZED_NAME_RECEIVED_PAYMENT) + private ReceivedPaymentRelationship receivedPayment; + + public static final String SERIALIZED_NAME_CHARGEBACK = "chargeback"; + @SerializedName(SERIALIZED_NAME_CHARGEBACK) + private ChargebackRelationship chargeback; + + public static final String SERIALIZED_NAME_REWARD = "reward"; + @SerializedName(SERIALIZED_NAME_REWARD) + private RewardRelationship reward; + + public TransactionRelationships() { + } + + public TransactionRelationships account(AccountRelationship2 account) { + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nonnull + public AccountRelationship2 getAccount() { + return account; + } + + + public void setAccount(AccountRelationship2 account) { + this.account = account; + } + + + public TransactionRelationships receivingAccount(ReceivingAccountRelationship receivingAccount) { + + this.receivingAccount = receivingAccount; + return this; + } + + /** + * Get receivingAccount + * @return receivingAccount + **/ + @javax.annotation.Nullable + public ReceivingAccountRelationship getReceivingAccount() { + return receivingAccount; + } + + + public void setReceivingAccount(ReceivingAccountRelationship receivingAccount) { + this.receivingAccount = receivingAccount; + } + + + public TransactionRelationships customer(CustomerRelationship customer) { + + this.customer = customer; + return this; + } + + /** + * Get customer + * @return customer + **/ + @javax.annotation.Nullable + public CustomerRelationship getCustomer() { + return customer; + } + + + public void setCustomer(CustomerRelationship customer) { + this.customer = customer; + } + + + public TransactionRelationships customers(CustomersRelationship customers) { + + this.customers = customers; + return this; + } + + /** + * Get customers + * @return customers + **/ + @javax.annotation.Nullable + public CustomersRelationship getCustomers() { + return customers; + } + + + public void setCustomers(CustomersRelationship customers) { + this.customers = customers; + } + + + public TransactionRelationships counterpartyAccount(CounterpartyAccountRelationship1 counterpartyAccount) { + + this.counterpartyAccount = counterpartyAccount; + return this; + } + + /** + * Get counterpartyAccount + * @return counterpartyAccount + **/ + @javax.annotation.Nullable + public CounterpartyAccountRelationship1 getCounterpartyAccount() { + return counterpartyAccount; + } + + + public void setCounterpartyAccount(CounterpartyAccountRelationship1 counterpartyAccount) { + this.counterpartyAccount = counterpartyAccount; + } + + + public TransactionRelationships counterpartyCustomer(CounterpartyCustomerRelationship counterpartyCustomer) { + + this.counterpartyCustomer = counterpartyCustomer; + return this; + } + + /** + * Get counterpartyCustomer + * @return counterpartyCustomer + **/ + @javax.annotation.Nullable + public CounterpartyCustomerRelationship getCounterpartyCustomer() { + return counterpartyCustomer; + } + + + public void setCounterpartyCustomer(CounterpartyCustomerRelationship counterpartyCustomer) { + this.counterpartyCustomer = counterpartyCustomer; + } + + + public TransactionRelationships relatedTransaction(RelatedTransactionRelationship relatedTransaction) { + + this.relatedTransaction = relatedTransaction; + return this; + } + + /** + * Get relatedTransaction + * @return relatedTransaction + **/ + @javax.annotation.Nullable + public RelatedTransactionRelationship getRelatedTransaction() { + return relatedTransaction; + } + + + public void setRelatedTransaction(RelatedTransactionRelationship relatedTransaction) { + this.relatedTransaction = relatedTransaction; + } + + + public TransactionRelationships disputedTransaction(RelatedTransaction disputedTransaction) { + + this.disputedTransaction = disputedTransaction; + return this; + } + + /** + * Get disputedTransaction + * @return disputedTransaction + **/ + @javax.annotation.Nullable + public RelatedTransaction getDisputedTransaction() { + return disputedTransaction; + } + + + public void setDisputedTransaction(RelatedTransaction disputedTransaction) { + this.disputedTransaction = disputedTransaction; + } + + + public TransactionRelationships authorization(AuthorizationRelationship authorization) { + + this.authorization = authorization; + return this; + } + + /** + * Get authorization + * @return authorization + **/ + @javax.annotation.Nullable + public AuthorizationRelationship getAuthorization() { + return authorization; + } + + + public void setAuthorization(AuthorizationRelationship authorization) { + this.authorization = authorization; + } + + + public TransactionRelationships returned(ReturnedRelationship returned) { + + this.returned = returned; + return this; + } + + /** + * Get returned + * @return returned + **/ + @javax.annotation.Nullable + public ReturnedRelationship getReturned() { + return returned; + } + + + public void setReturned(ReturnedRelationship returned) { + this.returned = returned; + } + + + public TransactionRelationships payment(PaymentRelationship payment) { + + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + **/ + @javax.annotation.Nullable + public PaymentRelationship getPayment() { + return payment; + } + + + public void setPayment(PaymentRelationship payment) { + this.payment = payment; + } + + + public TransactionRelationships checkPayment(CheckPaymentRelationship checkPayment) { + + this.checkPayment = checkPayment; + return this; + } + + /** + * Get checkPayment + * @return checkPayment + **/ + @javax.annotation.Nullable + public CheckPaymentRelationship getCheckPayment() { + return checkPayment; + } + + + public void setCheckPayment(CheckPaymentRelationship checkPayment) { + this.checkPayment = checkPayment; + } + + + public TransactionRelationships repayment(RepaymentRelationship repayment) { + + this.repayment = repayment; + return this; + } + + /** + * Get repayment + * @return repayment + **/ + @javax.annotation.Nullable + public RepaymentRelationship getRepayment() { + return repayment; + } + + + public void setRepayment(RepaymentRelationship repayment) { + this.repayment = repayment; + } + + + public TransactionRelationships recurringPayment(RecurringPaymentRelationship recurringPayment) { + + this.recurringPayment = recurringPayment; + return this; + } + + /** + * Get recurringPayment + * @return recurringPayment + **/ + @javax.annotation.Nullable + public RecurringPaymentRelationship getRecurringPayment() { + return recurringPayment; + } + + + public void setRecurringPayment(RecurringPaymentRelationship recurringPayment) { + this.recurringPayment = recurringPayment; + } + + + public TransactionRelationships org(OrgRelationship org) { + + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @javax.annotation.Nullable + public OrgRelationship getOrg() { + return org; + } + + + public void setOrg(OrgRelationship org) { + this.org = org; + } + + + public TransactionRelationships card(CardRelationship card) { + + this.card = card; + return this; + } + + /** + * Get card + * @return card + **/ + @javax.annotation.Nullable + public CardRelationship getCard() { + return card; + } + + + public void setCard(CardRelationship card) { + this.card = card; + } + + + public TransactionRelationships incomingAch(IncomingAchRelationship incomingAch) { + + this.incomingAch = incomingAch; + return this; + } + + /** + * Get incomingAch + * @return incomingAch + **/ + @javax.annotation.Nullable + public IncomingAchRelationship getIncomingAch() { + return incomingAch; + } + + + public void setIncomingAch(IncomingAchRelationship incomingAch) { + this.incomingAch = incomingAch; + } + + + public TransactionRelationships checkDeposit(CheckDepositRelationship checkDeposit) { + + this.checkDeposit = checkDeposit; + return this; + } + + /** + * Get checkDeposit + * @return checkDeposit + **/ + @javax.annotation.Nullable + public CheckDepositRelationship getCheckDeposit() { + return checkDeposit; + } + + + public void setCheckDeposit(CheckDepositRelationship checkDeposit) { + this.checkDeposit = checkDeposit; + } + + + public TransactionRelationships authorizationRequest(AuthorizationRequestRelationship authorizationRequest) { + + this.authorizationRequest = authorizationRequest; + return this; + } + + /** + * Get authorizationRequest + * @return authorizationRequest + **/ + @javax.annotation.Nullable + public AuthorizationRequestRelationship getAuthorizationRequest() { + return authorizationRequest; + } + + + public void setAuthorizationRequest(AuthorizationRequestRelationship authorizationRequest) { + this.authorizationRequest = authorizationRequest; + } + + + public TransactionRelationships paymentAdvanceTransaction(RelatedTransaction paymentAdvanceTransaction) { + + this.paymentAdvanceTransaction = paymentAdvanceTransaction; + return this; + } + + /** + * Get paymentAdvanceTransaction + * @return paymentAdvanceTransaction + **/ + @javax.annotation.Nullable + public RelatedTransaction getPaymentAdvanceTransaction() { + return paymentAdvanceTransaction; + } + + + public void setPaymentAdvanceTransaction(RelatedTransaction paymentAdvanceTransaction) { + this.paymentAdvanceTransaction = paymentAdvanceTransaction; + } + + + public TransactionRelationships receivedPayment(ReceivedPaymentRelationship receivedPayment) { + + this.receivedPayment = receivedPayment; + return this; + } + + /** + * Get receivedPayment + * @return receivedPayment + **/ + @javax.annotation.Nullable + public ReceivedPaymentRelationship getReceivedPayment() { + return receivedPayment; + } + + + public void setReceivedPayment(ReceivedPaymentRelationship receivedPayment) { + this.receivedPayment = receivedPayment; + } + + + public TransactionRelationships chargeback(ChargebackRelationship chargeback) { + + this.chargeback = chargeback; + return this; + } + + /** + * Get chargeback + * @return chargeback + **/ + @javax.annotation.Nullable + public ChargebackRelationship getChargeback() { + return chargeback; + } + + + public void setChargeback(ChargebackRelationship chargeback) { + this.chargeback = chargeback; + } + + + public TransactionRelationships reward(RewardRelationship reward) { + + this.reward = reward; + return this; + } + + /** + * Get reward + * @return reward + **/ + @javax.annotation.Nullable + public RewardRelationship getReward() { + return reward; + } + + + public void setReward(RewardRelationship reward) { + this.reward = reward; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionRelationships transactionRelationships = (TransactionRelationships) o; + return Objects.equals(this.account, transactionRelationships.account) && + Objects.equals(this.receivingAccount, transactionRelationships.receivingAccount) && + Objects.equals(this.customer, transactionRelationships.customer) && + Objects.equals(this.customers, transactionRelationships.customers) && + Objects.equals(this.counterpartyAccount, transactionRelationships.counterpartyAccount) && + Objects.equals(this.counterpartyCustomer, transactionRelationships.counterpartyCustomer) && + Objects.equals(this.relatedTransaction, transactionRelationships.relatedTransaction) && + Objects.equals(this.disputedTransaction, transactionRelationships.disputedTransaction) && + Objects.equals(this.authorization, transactionRelationships.authorization) && + Objects.equals(this.returned, transactionRelationships.returned) && + Objects.equals(this.payment, transactionRelationships.payment) && + Objects.equals(this.checkPayment, transactionRelationships.checkPayment) && + Objects.equals(this.repayment, transactionRelationships.repayment) && + Objects.equals(this.recurringPayment, transactionRelationships.recurringPayment) && + Objects.equals(this.org, transactionRelationships.org) && + Objects.equals(this.card, transactionRelationships.card) && + Objects.equals(this.incomingAch, transactionRelationships.incomingAch) && + Objects.equals(this.checkDeposit, transactionRelationships.checkDeposit) && + Objects.equals(this.authorizationRequest, transactionRelationships.authorizationRequest) && + Objects.equals(this.paymentAdvanceTransaction, transactionRelationships.paymentAdvanceTransaction) && + Objects.equals(this.receivedPayment, transactionRelationships.receivedPayment) && + Objects.equals(this.chargeback, transactionRelationships.chargeback) && + Objects.equals(this.reward, transactionRelationships.reward); + } + + @Override + public int hashCode() { + return Objects.hash(account, receivingAccount, customer, customers, counterpartyAccount, counterpartyCustomer, relatedTransaction, disputedTransaction, authorization, returned, payment, checkPayment, repayment, recurringPayment, org, card, incomingAch, checkDeposit, authorizationRequest, paymentAdvanceTransaction, receivedPayment, chargeback, reward); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransactionRelationships {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" receivingAccount: ").append(toIndentedString(receivingAccount)).append("\n"); + sb.append(" customer: ").append(toIndentedString(customer)).append("\n"); + sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append(" counterpartyAccount: ").append(toIndentedString(counterpartyAccount)).append("\n"); + sb.append(" counterpartyCustomer: ").append(toIndentedString(counterpartyCustomer)).append("\n"); + sb.append(" relatedTransaction: ").append(toIndentedString(relatedTransaction)).append("\n"); + sb.append(" disputedTransaction: ").append(toIndentedString(disputedTransaction)).append("\n"); + sb.append(" authorization: ").append(toIndentedString(authorization)).append("\n"); + sb.append(" returned: ").append(toIndentedString(returned)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" checkPayment: ").append(toIndentedString(checkPayment)).append("\n"); + sb.append(" repayment: ").append(toIndentedString(repayment)).append("\n"); + sb.append(" recurringPayment: ").append(toIndentedString(recurringPayment)).append("\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append(" card: ").append(toIndentedString(card)).append("\n"); + sb.append(" incomingAch: ").append(toIndentedString(incomingAch)).append("\n"); + sb.append(" checkDeposit: ").append(toIndentedString(checkDeposit)).append("\n"); + sb.append(" authorizationRequest: ").append(toIndentedString(authorizationRequest)).append("\n"); + sb.append(" paymentAdvanceTransaction: ").append(toIndentedString(paymentAdvanceTransaction)).append("\n"); + sb.append(" receivedPayment: ").append(toIndentedString(receivedPayment)).append("\n"); + sb.append(" chargeback: ").append(toIndentedString(chargeback)).append("\n"); + sb.append(" reward: ").append(toIndentedString(reward)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("receivingAccount"); + openapiFields.add("customer"); + openapiFields.add("customers"); + openapiFields.add("counterpartyAccount"); + openapiFields.add("counterpartyCustomer"); + openapiFields.add("relatedTransaction"); + openapiFields.add("disputedTransaction"); + openapiFields.add("authorization"); + openapiFields.add("returned"); + openapiFields.add("payment"); + openapiFields.add("checkPayment"); + openapiFields.add("repayment"); + openapiFields.add("recurringPayment"); + openapiFields.add("org"); + openapiFields.add("card"); + openapiFields.add("incomingAch"); + openapiFields.add("checkDeposit"); + openapiFields.add("authorizationRequest"); + openapiFields.add("paymentAdvanceTransaction"); + openapiFields.add("receivedPayment"); + openapiFields.add("chargeback"); + openapiFields.add("reward"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("account"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransactionRelationships + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransactionRelationships.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransactionRelationships is not found in the empty JSON string", TransactionRelationships.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TransactionRelationships.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TransactionRelationships` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TransactionRelationships.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `account` + AccountRelationship2.validateJsonElement(jsonObj.get("account")); + // validate the optional field `receivingAccount` + if (jsonObj.get("receivingAccount") != null && !jsonObj.get("receivingAccount").isJsonNull()) { + ReceivingAccountRelationship.validateJsonElement(jsonObj.get("receivingAccount")); + } + // validate the optional field `customer` + if (jsonObj.get("customer") != null && !jsonObj.get("customer").isJsonNull()) { + CustomerRelationship.validateJsonElement(jsonObj.get("customer")); + } + // validate the optional field `customers` + if (jsonObj.get("customers") != null && !jsonObj.get("customers").isJsonNull()) { + CustomersRelationship.validateJsonElement(jsonObj.get("customers")); + } + // validate the optional field `counterpartyAccount` + if (jsonObj.get("counterpartyAccount") != null && !jsonObj.get("counterpartyAccount").isJsonNull()) { + CounterpartyAccountRelationship1.validateJsonElement(jsonObj.get("counterpartyAccount")); + } + // validate the optional field `counterpartyCustomer` + if (jsonObj.get("counterpartyCustomer") != null && !jsonObj.get("counterpartyCustomer").isJsonNull()) { + CounterpartyCustomerRelationship.validateJsonElement(jsonObj.get("counterpartyCustomer")); + } + // validate the optional field `relatedTransaction` + if (jsonObj.get("relatedTransaction") != null && !jsonObj.get("relatedTransaction").isJsonNull()) { + RelatedTransactionRelationship.validateJsonElement(jsonObj.get("relatedTransaction")); + } + // validate the optional field `disputedTransaction` + if (jsonObj.get("disputedTransaction") != null && !jsonObj.get("disputedTransaction").isJsonNull()) { + RelatedTransaction.validateJsonElement(jsonObj.get("disputedTransaction")); + } + // validate the optional field `authorization` + if (jsonObj.get("authorization") != null && !jsonObj.get("authorization").isJsonNull()) { + AuthorizationRelationship.validateJsonElement(jsonObj.get("authorization")); + } + // validate the optional field `returned` + if (jsonObj.get("returned") != null && !jsonObj.get("returned").isJsonNull()) { + ReturnedRelationship.validateJsonElement(jsonObj.get("returned")); + } + // validate the optional field `payment` + if (jsonObj.get("payment") != null && !jsonObj.get("payment").isJsonNull()) { + PaymentRelationship.validateJsonElement(jsonObj.get("payment")); + } + // validate the optional field `checkPayment` + if (jsonObj.get("checkPayment") != null && !jsonObj.get("checkPayment").isJsonNull()) { + CheckPaymentRelationship.validateJsonElement(jsonObj.get("checkPayment")); + } + // validate the optional field `repayment` + if (jsonObj.get("repayment") != null && !jsonObj.get("repayment").isJsonNull()) { + RepaymentRelationship.validateJsonElement(jsonObj.get("repayment")); + } + // validate the optional field `recurringPayment` + if (jsonObj.get("recurringPayment") != null && !jsonObj.get("recurringPayment").isJsonNull()) { + RecurringPaymentRelationship.validateJsonElement(jsonObj.get("recurringPayment")); + } + // validate the optional field `org` + if (jsonObj.get("org") != null && !jsonObj.get("org").isJsonNull()) { + OrgRelationship.validateJsonElement(jsonObj.get("org")); + } + // validate the optional field `card` + if (jsonObj.get("card") != null && !jsonObj.get("card").isJsonNull()) { + CardRelationship.validateJsonElement(jsonObj.get("card")); + } + // validate the optional field `incomingAch` + if (jsonObj.get("incomingAch") != null && !jsonObj.get("incomingAch").isJsonNull()) { + IncomingAchRelationship.validateJsonElement(jsonObj.get("incomingAch")); + } + // validate the optional field `checkDeposit` + if (jsonObj.get("checkDeposit") != null && !jsonObj.get("checkDeposit").isJsonNull()) { + CheckDepositRelationship.validateJsonElement(jsonObj.get("checkDeposit")); + } + // validate the optional field `authorizationRequest` + if (jsonObj.get("authorizationRequest") != null && !jsonObj.get("authorizationRequest").isJsonNull()) { + AuthorizationRequestRelationship.validateJsonElement(jsonObj.get("authorizationRequest")); + } + // validate the optional field `paymentAdvanceTransaction` + if (jsonObj.get("paymentAdvanceTransaction") != null && !jsonObj.get("paymentAdvanceTransaction").isJsonNull()) { + RelatedTransaction.validateJsonElement(jsonObj.get("paymentAdvanceTransaction")); + } + // validate the optional field `receivedPayment` + if (jsonObj.get("receivedPayment") != null && !jsonObj.get("receivedPayment").isJsonNull()) { + ReceivedPaymentRelationship.validateJsonElement(jsonObj.get("receivedPayment")); + } + // validate the optional field `chargeback` + if (jsonObj.get("chargeback") != null && !jsonObj.get("chargeback").isJsonNull()) { + ChargebackRelationship.validateJsonElement(jsonObj.get("chargeback")); + } + // validate the optional field `reward` + if (jsonObj.get("reward") != null && !jsonObj.get("reward").isJsonNull()) { + RewardRelationship.validateJsonElement(jsonObj.get("reward")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransactionRelationships.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransactionRelationships' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransactionRelationships.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransactionRelationships value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TransactionRelationships read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransactionRelationships given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransactionRelationships + * @throws IOException if the JSON string is invalid with respect to TransactionRelationships + */ + public static TransactionRelationships fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransactionRelationships.class); + } + + /** + * Convert an instance of TransactionRelationships to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TrustApplication.java b/src/main/java/org/openapitools/client/model/TrustApplication.java new file mode 100644 index 00000000..a43afa89 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TrustApplication.java @@ -0,0 +1,250 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.ApplicationRelationships; +import org.openapitools.client.model.TrustApplicationAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TrustApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TrustApplication extends Application { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private TrustApplicationAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private ApplicationRelationships relationships; + + public TrustApplication() { + this.type = this.getClass().getSimpleName(); + } + + public TrustApplication attributes(TrustApplicationAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public TrustApplicationAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(TrustApplicationAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public TrustApplication relationships(ApplicationRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public ApplicationRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(ApplicationRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrustApplication trustApplication = (TrustApplication) o; + return Objects.equals(this.attributes, trustApplication.attributes) && + Objects.equals(this.relationships, trustApplication.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrustApplication {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrustApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrustApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TrustApplication is not found in the empty JSON string", TrustApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrustApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrustApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TrustApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrustApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrustApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TrustApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TrustApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrustApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TrustApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrustApplication + * @throws IOException if the JSON string is invalid with respect to TrustApplication + */ + public static TrustApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrustApplication.class); + } + + /** + * Convert an instance of TrustApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TrustApplicationAllOfAttributes.java b/src/main/java/org/openapitools/client/model/TrustApplicationAllOfAttributes.java new file mode 100644 index 00000000..a6989cc8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TrustApplicationAllOfAttributes.java @@ -0,0 +1,1127 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApplicationStatus; +import org.openapitools.client.model.Grantor; +import org.openapitools.client.model.Revocability; +import org.openapitools.client.model.SourceOfFunds; +import org.openapitools.client.model.TrustContact; +import org.openapitools.client.model.Trustee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TrustApplicationAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TrustApplicationAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private ApplicationStatus status; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_EVALUATION_OUTCOME = "evaluationOutcome"; + @SerializedName(SERIALIZED_NAME_EVALUATION_OUTCOME) + private String evaluationOutcome; + + public static final String SERIALIZED_NAME_EVALUATION_ID = "evaluationId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ID) + private String evaluationId; + + public static final String SERIALIZED_NAME_EVALUATION_ENTITY_ID = "evaluationEntityId"; + @SerializedName(SERIALIZED_NAME_EVALUATION_ENTITY_ID) + private String evaluationEntityId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DATE_OF_INCORPORATION = "dateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_DATE_OF_INCORPORATION) + private LocalDate dateOfIncorporation; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_REVOCABILITY = "revocability"; + @SerializedName(SERIALIZED_NAME_REVOCABILITY) + private Revocability revocability; + + public static final String SERIALIZED_NAME_SOURCE_OF_FUNDS = "sourceOfFunds"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_FUNDS) + private SourceOfFunds sourceOfFunds; + + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @SerializedName(SERIALIZED_NAME_TAX_ID) + private String taxId; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private TrustContact contact; + + public static final String SERIALIZED_NAME_TRUSTEES = "trustees"; + @SerializedName(SERIALIZED_NAME_TRUSTEES) + private List trustees; + + public static final String SERIALIZED_NAME_GRANTOR = "grantor"; + @SerializedName(SERIALIZED_NAME_GRANTOR) + private Grantor grantor; + + public static final String SERIALIZED_NAME_IP = "ip"; + @SerializedName(SERIALIZED_NAME_IP) + private String ip; + + /** + * Gets or Sets decisionMethod + */ + @JsonAdapter(DecisionMethodEnum.Adapter.class) + public enum DecisionMethodEnum { + MANUALLY("Manually"), + + AUTOMATICALLY("Automatically"); + + private String value; + + DecisionMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DecisionMethodEnum fromValue(String value) { + for (DecisionMethodEnum b : DecisionMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DecisionMethodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DecisionMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DecisionMethodEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DECISION_METHOD = "decisionMethod"; + @SerializedName(SERIALIZED_NAME_DECISION_METHOD) + private DecisionMethodEnum decisionMethod; + + public static final String SERIALIZED_NAME_DECISION_USER_ID = "decisionUserId"; + @SerializedName(SERIALIZED_NAME_DECISION_USER_ID) + private String decisionUserId; + + public static final String SERIALIZED_NAME_DECISION_REASON = "decisionReason"; + @SerializedName(SERIALIZED_NAME_DECISION_REASON) + private String decisionReason; + + public static final String SERIALIZED_NAME_DECISION_DATE_TIME = "decisionDateTime"; + @SerializedName(SERIALIZED_NAME_DECISION_DATE_TIME) + private OffsetDateTime decisionDateTime; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + /** + * Gets or Sets riskRate + */ + @JsonAdapter(RiskRateEnum.Adapter.class) + public enum RiskRateEnum { + LOW("low"), + + MEDIUM("medium"), + + HIGH("high"); + + private String value; + + RiskRateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RiskRateEnum fromValue(String value) { + for (RiskRateEnum b : RiskRateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RiskRateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RiskRateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RiskRateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RISK_RATE = "riskRate"; + @SerializedName(SERIALIZED_NAME_RISK_RATE) + private RiskRateEnum riskRate; + + public static final String SERIALIZED_NAME_EVALUATION_FLAGS = "evaluationFlags"; + @SerializedName(SERIALIZED_NAME_EVALUATION_FLAGS) + private List evaluationFlags; + + public static final String SERIALIZED_NAME_IP_LOCATION_DETAILS = "ipLocationDetails"; + @SerializedName(SERIALIZED_NAME_IP_LOCATION_DETAILS) + private Object ipLocationDetails; + + public static final String SERIALIZED_NAME_PHONE_LOCATION_DETAILS = "phoneLocationDetails"; + @SerializedName(SERIALIZED_NAME_PHONE_LOCATION_DETAILS) + private Object phoneLocationDetails; + + public static final String SERIALIZED_NAME_ARCHIVED = "archived"; + @SerializedName(SERIALIZED_NAME_ARCHIVED) + private Boolean archived; + + public TrustApplicationAllOfAttributes() { + } + + public TrustApplicationAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public TrustApplicationAllOfAttributes updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public TrustApplicationAllOfAttributes status(ApplicationStatus status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public ApplicationStatus getStatus() { + return status; + } + + + public void setStatus(ApplicationStatus status) { + this.status = status; + } + + + public TrustApplicationAllOfAttributes message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public TrustApplicationAllOfAttributes evaluationOutcome(String evaluationOutcome) { + + this.evaluationOutcome = evaluationOutcome; + return this; + } + + /** + * Get evaluationOutcome + * @return evaluationOutcome + **/ + @javax.annotation.Nullable + public String getEvaluationOutcome() { + return evaluationOutcome; + } + + + public void setEvaluationOutcome(String evaluationOutcome) { + this.evaluationOutcome = evaluationOutcome; + } + + + public TrustApplicationAllOfAttributes evaluationId(String evaluationId) { + + this.evaluationId = evaluationId; + return this; + } + + /** + * Get evaluationId + * @return evaluationId + **/ + @javax.annotation.Nullable + public String getEvaluationId() { + return evaluationId; + } + + + public void setEvaluationId(String evaluationId) { + this.evaluationId = evaluationId; + } + + + public TrustApplicationAllOfAttributes evaluationEntityId(String evaluationEntityId) { + + this.evaluationEntityId = evaluationEntityId; + return this; + } + + /** + * Get evaluationEntityId + * @return evaluationEntityId + **/ + @javax.annotation.Nullable + public String getEvaluationEntityId() { + return evaluationEntityId; + } + + + public void setEvaluationEntityId(String evaluationEntityId) { + this.evaluationEntityId = evaluationEntityId; + } + + + public TrustApplicationAllOfAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public TrustApplicationAllOfAttributes dateOfIncorporation(LocalDate dateOfIncorporation) { + + this.dateOfIncorporation = dateOfIncorporation; + return this; + } + + /** + * Get dateOfIncorporation + * @return dateOfIncorporation + **/ + @javax.annotation.Nullable + public LocalDate getDateOfIncorporation() { + return dateOfIncorporation; + } + + + public void setDateOfIncorporation(LocalDate dateOfIncorporation) { + this.dateOfIncorporation = dateOfIncorporation; + } + + + public TrustApplicationAllOfAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nonnull + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public TrustApplicationAllOfAttributes revocability(Revocability revocability) { + + this.revocability = revocability; + return this; + } + + /** + * Get revocability + * @return revocability + **/ + @javax.annotation.Nullable + public Revocability getRevocability() { + return revocability; + } + + + public void setRevocability(Revocability revocability) { + this.revocability = revocability; + } + + + public TrustApplicationAllOfAttributes sourceOfFunds(SourceOfFunds sourceOfFunds) { + + this.sourceOfFunds = sourceOfFunds; + return this; + } + + /** + * Get sourceOfFunds + * @return sourceOfFunds + **/ + @javax.annotation.Nullable + public SourceOfFunds getSourceOfFunds() { + return sourceOfFunds; + } + + + public void setSourceOfFunds(SourceOfFunds sourceOfFunds) { + this.sourceOfFunds = sourceOfFunds; + } + + + public TrustApplicationAllOfAttributes taxId(String taxId) { + + this.taxId = taxId; + return this; + } + + /** + * Get taxId + * @return taxId + **/ + @javax.annotation.Nullable + public String getTaxId() { + return taxId; + } + + + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + + public TrustApplicationAllOfAttributes contact(TrustContact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nonnull + public TrustContact getContact() { + return contact; + } + + + public void setContact(TrustContact contact) { + this.contact = contact; + } + + + public TrustApplicationAllOfAttributes trustees(List trustees) { + + this.trustees = trustees; + return this; + } + + public TrustApplicationAllOfAttributes addTrusteesItem(Trustee trusteesItem) { + if (this.trustees == null) { + this.trustees = new ArrayList<>(); + } + this.trustees.add(trusteesItem); + return this; + } + + /** + * Get trustees + * @return trustees + **/ + @javax.annotation.Nullable + public List getTrustees() { + return trustees; + } + + + public void setTrustees(List trustees) { + this.trustees = trustees; + } + + + public TrustApplicationAllOfAttributes grantor(Grantor grantor) { + + this.grantor = grantor; + return this; + } + + /** + * Get grantor + * @return grantor + **/ + @javax.annotation.Nullable + public Grantor getGrantor() { + return grantor; + } + + + public void setGrantor(Grantor grantor) { + this.grantor = grantor; + } + + + public TrustApplicationAllOfAttributes ip(String ip) { + + this.ip = ip; + return this; + } + + /** + * Get ip + * @return ip + **/ + @javax.annotation.Nullable + public String getIp() { + return ip; + } + + + public void setIp(String ip) { + this.ip = ip; + } + + + public TrustApplicationAllOfAttributes decisionMethod(DecisionMethodEnum decisionMethod) { + + this.decisionMethod = decisionMethod; + return this; + } + + /** + * Get decisionMethod + * @return decisionMethod + **/ + @javax.annotation.Nullable + public DecisionMethodEnum getDecisionMethod() { + return decisionMethod; + } + + + public void setDecisionMethod(DecisionMethodEnum decisionMethod) { + this.decisionMethod = decisionMethod; + } + + + public TrustApplicationAllOfAttributes decisionUserId(String decisionUserId) { + + this.decisionUserId = decisionUserId; + return this; + } + + /** + * Get decisionUserId + * @return decisionUserId + **/ + @javax.annotation.Nullable + public String getDecisionUserId() { + return decisionUserId; + } + + + public void setDecisionUserId(String decisionUserId) { + this.decisionUserId = decisionUserId; + } + + + public TrustApplicationAllOfAttributes decisionReason(String decisionReason) { + + this.decisionReason = decisionReason; + return this; + } + + /** + * Get decisionReason + * @return decisionReason + **/ + @javax.annotation.Nullable + public String getDecisionReason() { + return decisionReason; + } + + + public void setDecisionReason(String decisionReason) { + this.decisionReason = decisionReason; + } + + + public TrustApplicationAllOfAttributes decisionDateTime(OffsetDateTime decisionDateTime) { + + this.decisionDateTime = decisionDateTime; + return this; + } + + /** + * Get decisionDateTime + * @return decisionDateTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getDecisionDateTime() { + return decisionDateTime; + } + + + public void setDecisionDateTime(OffsetDateTime decisionDateTime) { + this.decisionDateTime = decisionDateTime; + } + + + public TrustApplicationAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public TrustApplicationAllOfAttributes riskRate(RiskRateEnum riskRate) { + + this.riskRate = riskRate; + return this; + } + + /** + * Get riskRate + * @return riskRate + **/ + @javax.annotation.Nullable + public RiskRateEnum getRiskRate() { + return riskRate; + } + + + public void setRiskRate(RiskRateEnum riskRate) { + this.riskRate = riskRate; + } + + + public TrustApplicationAllOfAttributes evaluationFlags(List evaluationFlags) { + + this.evaluationFlags = evaluationFlags; + return this; + } + + public TrustApplicationAllOfAttributes addEvaluationFlagsItem(String evaluationFlagsItem) { + if (this.evaluationFlags == null) { + this.evaluationFlags = new ArrayList<>(); + } + this.evaluationFlags.add(evaluationFlagsItem); + return this; + } + + /** + * Get evaluationFlags + * @return evaluationFlags + **/ + @javax.annotation.Nullable + public List getEvaluationFlags() { + return evaluationFlags; + } + + + public void setEvaluationFlags(List evaluationFlags) { + this.evaluationFlags = evaluationFlags; + } + + + public TrustApplicationAllOfAttributes ipLocationDetails(Object ipLocationDetails) { + + this.ipLocationDetails = ipLocationDetails; + return this; + } + + /** + * Get ipLocationDetails + * @return ipLocationDetails + **/ + @javax.annotation.Nullable + public Object getIpLocationDetails() { + return ipLocationDetails; + } + + + public void setIpLocationDetails(Object ipLocationDetails) { + this.ipLocationDetails = ipLocationDetails; + } + + + public TrustApplicationAllOfAttributes phoneLocationDetails(Object phoneLocationDetails) { + + this.phoneLocationDetails = phoneLocationDetails; + return this; + } + + /** + * Get phoneLocationDetails + * @return phoneLocationDetails + **/ + @javax.annotation.Nullable + public Object getPhoneLocationDetails() { + return phoneLocationDetails; + } + + + public void setPhoneLocationDetails(Object phoneLocationDetails) { + this.phoneLocationDetails = phoneLocationDetails; + } + + + public TrustApplicationAllOfAttributes archived(Boolean archived) { + + this.archived = archived; + return this; + } + + /** + * Get archived + * @return archived + **/ + @javax.annotation.Nullable + public Boolean getArchived() { + return archived; + } + + + public void setArchived(Boolean archived) { + this.archived = archived; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrustApplicationAllOfAttributes trustApplicationAllOfAttributes = (TrustApplicationAllOfAttributes) o; + return Objects.equals(this.createdAt, trustApplicationAllOfAttributes.createdAt) && + Objects.equals(this.updatedAt, trustApplicationAllOfAttributes.updatedAt) && + Objects.equals(this.status, trustApplicationAllOfAttributes.status) && + Objects.equals(this.message, trustApplicationAllOfAttributes.message) && + Objects.equals(this.evaluationOutcome, trustApplicationAllOfAttributes.evaluationOutcome) && + Objects.equals(this.evaluationId, trustApplicationAllOfAttributes.evaluationId) && + Objects.equals(this.evaluationEntityId, trustApplicationAllOfAttributes.evaluationEntityId) && + Objects.equals(this.name, trustApplicationAllOfAttributes.name) && + Objects.equals(this.dateOfIncorporation, trustApplicationAllOfAttributes.dateOfIncorporation) && + Objects.equals(this.stateOfIncorporation, trustApplicationAllOfAttributes.stateOfIncorporation) && + Objects.equals(this.revocability, trustApplicationAllOfAttributes.revocability) && + Objects.equals(this.sourceOfFunds, trustApplicationAllOfAttributes.sourceOfFunds) && + Objects.equals(this.taxId, trustApplicationAllOfAttributes.taxId) && + Objects.equals(this.contact, trustApplicationAllOfAttributes.contact) && + Objects.equals(this.trustees, trustApplicationAllOfAttributes.trustees) && + Objects.equals(this.grantor, trustApplicationAllOfAttributes.grantor) && + Objects.equals(this.ip, trustApplicationAllOfAttributes.ip) && + Objects.equals(this.decisionMethod, trustApplicationAllOfAttributes.decisionMethod) && + Objects.equals(this.decisionUserId, trustApplicationAllOfAttributes.decisionUserId) && + Objects.equals(this.decisionReason, trustApplicationAllOfAttributes.decisionReason) && + Objects.equals(this.decisionDateTime, trustApplicationAllOfAttributes.decisionDateTime) && + Objects.equals(this.tags, trustApplicationAllOfAttributes.tags) && + Objects.equals(this.riskRate, trustApplicationAllOfAttributes.riskRate) && + Objects.equals(this.evaluationFlags, trustApplicationAllOfAttributes.evaluationFlags) && + Objects.equals(this.ipLocationDetails, trustApplicationAllOfAttributes.ipLocationDetails) && + Objects.equals(this.phoneLocationDetails, trustApplicationAllOfAttributes.phoneLocationDetails) && + Objects.equals(this.archived, trustApplicationAllOfAttributes.archived); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, status, message, evaluationOutcome, evaluationId, evaluationEntityId, name, dateOfIncorporation, stateOfIncorporation, revocability, sourceOfFunds, taxId, contact, trustees, grantor, ip, decisionMethod, decisionUserId, decisionReason, decisionDateTime, tags, riskRate, evaluationFlags, ipLocationDetails, phoneLocationDetails, archived); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrustApplicationAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" evaluationOutcome: ").append(toIndentedString(evaluationOutcome)).append("\n"); + sb.append(" evaluationId: ").append(toIndentedString(evaluationId)).append("\n"); + sb.append(" evaluationEntityId: ").append(toIndentedString(evaluationEntityId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" dateOfIncorporation: ").append(toIndentedString(dateOfIncorporation)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" revocability: ").append(toIndentedString(revocability)).append("\n"); + sb.append(" sourceOfFunds: ").append(toIndentedString(sourceOfFunds)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" trustees: ").append(toIndentedString(trustees)).append("\n"); + sb.append(" grantor: ").append(toIndentedString(grantor)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" decisionMethod: ").append(toIndentedString(decisionMethod)).append("\n"); + sb.append(" decisionUserId: ").append(toIndentedString(decisionUserId)).append("\n"); + sb.append(" decisionReason: ").append(toIndentedString(decisionReason)).append("\n"); + sb.append(" decisionDateTime: ").append(toIndentedString(decisionDateTime)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" riskRate: ").append(toIndentedString(riskRate)).append("\n"); + sb.append(" evaluationFlags: ").append(toIndentedString(evaluationFlags)).append("\n"); + sb.append(" ipLocationDetails: ").append(toIndentedString(ipLocationDetails)).append("\n"); + sb.append(" phoneLocationDetails: ").append(toIndentedString(phoneLocationDetails)).append("\n"); + sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("status"); + openapiFields.add("message"); + openapiFields.add("evaluationOutcome"); + openapiFields.add("evaluationId"); + openapiFields.add("evaluationEntityId"); + openapiFields.add("name"); + openapiFields.add("dateOfIncorporation"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("revocability"); + openapiFields.add("sourceOfFunds"); + openapiFields.add("taxId"); + openapiFields.add("contact"); + openapiFields.add("trustees"); + openapiFields.add("grantor"); + openapiFields.add("ip"); + openapiFields.add("decisionMethod"); + openapiFields.add("decisionUserId"); + openapiFields.add("decisionReason"); + openapiFields.add("decisionDateTime"); + openapiFields.add("tags"); + openapiFields.add("riskRate"); + openapiFields.add("evaluationFlags"); + openapiFields.add("ipLocationDetails"); + openapiFields.add("phoneLocationDetails"); + openapiFields.add("archived"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("stateOfIncorporation"); + openapiRequiredFields.add("contact"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrustApplicationAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrustApplicationAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TrustApplicationAllOfAttributes is not found in the empty JSON string", TrustApplicationAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrustApplicationAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrustApplicationAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TrustApplicationAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("evaluationOutcome") != null && !jsonObj.get("evaluationOutcome").isJsonNull()) && !jsonObj.get("evaluationOutcome").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationOutcome` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationOutcome").toString())); + } + if ((jsonObj.get("evaluationId") != null && !jsonObj.get("evaluationId").isJsonNull()) && !jsonObj.get("evaluationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationId").toString())); + } + if ((jsonObj.get("evaluationEntityId") != null && !jsonObj.get("evaluationEntityId").isJsonNull()) && !jsonObj.get("evaluationEntityId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationEntityId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("evaluationEntityId").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + if ((jsonObj.get("taxId") != null && !jsonObj.get("taxId").isJsonNull()) && !jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + // validate the required field `contact` + TrustContact.validateJsonElement(jsonObj.get("contact")); + if (jsonObj.get("trustees") != null && !jsonObj.get("trustees").isJsonNull()) { + JsonArray jsonArraytrustees = jsonObj.getAsJsonArray("trustees"); + if (jsonArraytrustees != null) { + // ensure the json data is an array + if (!jsonObj.get("trustees").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `trustees` to be an array in the JSON string but got `%s`", jsonObj.get("trustees").toString())); + } + + // validate the optional field `trustees` (array) + for (int i = 0; i < jsonArraytrustees.size(); i++) { + Trustee.validateJsonElement(jsonArraytrustees.get(i)); + }; + } + } + // validate the optional field `grantor` + if (jsonObj.get("grantor") != null && !jsonObj.get("grantor").isJsonNull()) { + Grantor.validateJsonElement(jsonObj.get("grantor")); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + if ((jsonObj.get("decisionMethod") != null && !jsonObj.get("decisionMethod").isJsonNull()) && !jsonObj.get("decisionMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionMethod").toString())); + } + if ((jsonObj.get("decisionUserId") != null && !jsonObj.get("decisionUserId").isJsonNull()) && !jsonObj.get("decisionUserId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionUserId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionUserId").toString())); + } + if ((jsonObj.get("decisionReason") != null && !jsonObj.get("decisionReason").isJsonNull()) && !jsonObj.get("decisionReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `decisionReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decisionReason").toString())); + } + if ((jsonObj.get("riskRate") != null && !jsonObj.get("riskRate").isJsonNull()) && !jsonObj.get("riskRate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `riskRate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskRate").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("evaluationFlags") != null && !jsonObj.get("evaluationFlags").isJsonNull() && !jsonObj.get("evaluationFlags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `evaluationFlags` to be an array in the JSON string but got `%s`", jsonObj.get("evaluationFlags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrustApplicationAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrustApplicationAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TrustApplicationAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TrustApplicationAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrustApplicationAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TrustApplicationAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrustApplicationAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to TrustApplicationAllOfAttributes + */ + public static TrustApplicationAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrustApplicationAllOfAttributes.class); + } + + /** + * Convert an instance of TrustApplicationAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TrustContact.java b/src/main/java/org/openapitools/client/model/TrustContact.java new file mode 100644 index 00000000..10bb595f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TrustContact.java @@ -0,0 +1,350 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TrustContact + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TrustContact { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public TrustContact() { + } + + public TrustContact fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nullable + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public TrustContact email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public TrustContact phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public TrustContact address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public TrustContact jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrustContact trustContact = (TrustContact) o; + return Objects.equals(this.fullName, trustContact.fullName) && + Objects.equals(this.email, trustContact.email) && + Objects.equals(this.phone, trustContact.phone) && + Objects.equals(this.address, trustContact.address) && + Objects.equals(this.jwtSubject, trustContact.jwtSubject); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, address, jwtSubject); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrustContact {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("jwtSubject"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrustContact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrustContact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TrustContact is not found in the empty JSON string", TrustContact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrustContact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrustContact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `fullName` + if (jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) { + FullName.validateJsonElement(jsonObj.get("fullName")); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrustContact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrustContact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TrustContact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TrustContact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrustContact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TrustContact given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrustContact + * @throws IOException if the JSON string is invalid with respect to TrustContact + */ + public static TrustContact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrustContact.class); + } + + /** + * Convert an instance of TrustContact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TrustCustomer.java b/src/main/java/org/openapitools/client/model/TrustCustomer.java new file mode 100644 index 00000000..71bb133e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TrustCustomer.java @@ -0,0 +1,240 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Customer; +import org.openapitools.client.model.CustomerRelationships; +import org.openapitools.client.model.TrustCustomerAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TrustCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TrustCustomer extends Customer { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private TrustCustomerAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private CustomerRelationships relationships; + + public TrustCustomer() { + this.type = this.getClass().getSimpleName(); + } + + public TrustCustomer attributes(TrustCustomerAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public TrustCustomerAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(TrustCustomerAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public TrustCustomer relationships(CustomerRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nullable + public CustomerRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(CustomerRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrustCustomer trustCustomer = (TrustCustomer) o; + return Objects.equals(this.attributes, trustCustomer.attributes) && + Objects.equals(this.relationships, trustCustomer.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrustCustomer {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrustCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrustCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TrustCustomer is not found in the empty JSON string", TrustCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrustCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrustCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrustCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrustCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TrustCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TrustCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrustCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TrustCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrustCustomer + * @throws IOException if the JSON string is invalid with respect to TrustCustomer + */ + public static TrustCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrustCustomer.class); + } + + /** + * Convert an instance of TrustCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/TrustCustomerAllOfAttributes.java b/src/main/java/org/openapitools/client/model/TrustCustomerAllOfAttributes.java new file mode 100644 index 00000000..6e6d1dcd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/TrustCustomerAllOfAttributes.java @@ -0,0 +1,728 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AuthorizedUser; +import org.openapitools.client.model.Revocability; +import org.openapitools.client.model.SourceOfFunds; +import org.openapitools.client.model.TrustContact; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TrustCustomerAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TrustCustomerAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_STATE_OF_INCORPORATION = "stateOfIncorporation"; + @SerializedName(SERIALIZED_NAME_STATE_OF_INCORPORATION) + private String stateOfIncorporation; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private TrustContact contact; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_REVOCABILITY = "revocability"; + @SerializedName(SERIALIZED_NAME_REVOCABILITY) + private Revocability revocability; + + public static final String SERIALIZED_NAME_SOURCE_OF_FUNDS = "sourceOfFunds"; + @SerializedName(SERIALIZED_NAME_SOURCE_OF_FUNDS) + private SourceOfFunds sourceOfFunds; + + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @SerializedName(SERIALIZED_NAME_TAX_ID) + private String taxId; + + /** + * Gets or Sets riskRate + */ + @JsonAdapter(RiskRateEnum.Adapter.class) + public enum RiskRateEnum { + LOW("low"), + + MEDIUM("medium"), + + HIGH("high"); + + private String value; + + RiskRateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RiskRateEnum fromValue(String value) { + for (RiskRateEnum b : RiskRateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RiskRateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RiskRateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RiskRateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_RISK_RATE = "riskRate"; + @SerializedName(SERIALIZED_NAME_RISK_RATE) + private RiskRateEnum riskRate; + + public static final String SERIALIZED_NAME_AUTHORIZED_USERS = "authorizedUsers"; + @SerializedName(SERIALIZED_NAME_AUTHORIZED_USERS) + private List authorizedUsers; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("Active"), + + ARCHIVED("Archived"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + /** + * Gets or Sets archiveReason + */ + @JsonAdapter(ArchiveReasonEnum.Adapter.class) + public enum ArchiveReasonEnum { + INACTIVE("Inactive"), + + FRAUDACHACTIVITY("FraudACHActivity"), + + FRAUDCARDACTIVITY("FraudCardActivity"), + + FRAUDCHECKACTIVITY("FraudCheckActivity"), + + FRAUDAPPLICATIONHISTORY("FraudApplicationHistory"), + + FRAUDACCOUNTACTIVITY("FraudAccountActivity"), + + FRAUDCLIENTIDENTIFIED("FraudClientIdentified"), + + FRAUDLINKEDTOFRAUDULENTCUSTOMER("FraudLinkedToFraudulentCustomer"); + + private String value; + + ArchiveReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ArchiveReasonEnum fromValue(String value) { + for (ArchiveReasonEnum b : ArchiveReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArchiveReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArchiveReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArchiveReasonEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ARCHIVE_REASON = "archiveReason"; + @SerializedName(SERIALIZED_NAME_ARCHIVE_REASON) + private ArchiveReasonEnum archiveReason; + + public TrustCustomerAllOfAttributes() { + } + + public TrustCustomerAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public TrustCustomerAllOfAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public TrustCustomerAllOfAttributes stateOfIncorporation(String stateOfIncorporation) { + + this.stateOfIncorporation = stateOfIncorporation; + return this; + } + + /** + * Get stateOfIncorporation + * @return stateOfIncorporation + **/ + @javax.annotation.Nonnull + public String getStateOfIncorporation() { + return stateOfIncorporation; + } + + + public void setStateOfIncorporation(String stateOfIncorporation) { + this.stateOfIncorporation = stateOfIncorporation; + } + + + public TrustCustomerAllOfAttributes contact(TrustContact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nonnull + public TrustContact getContact() { + return contact; + } + + + public void setContact(TrustContact contact) { + this.contact = contact; + } + + + public TrustCustomerAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public TrustCustomerAllOfAttributes revocability(Revocability revocability) { + + this.revocability = revocability; + return this; + } + + /** + * Get revocability + * @return revocability + **/ + @javax.annotation.Nullable + public Revocability getRevocability() { + return revocability; + } + + + public void setRevocability(Revocability revocability) { + this.revocability = revocability; + } + + + public TrustCustomerAllOfAttributes sourceOfFunds(SourceOfFunds sourceOfFunds) { + + this.sourceOfFunds = sourceOfFunds; + return this; + } + + /** + * Get sourceOfFunds + * @return sourceOfFunds + **/ + @javax.annotation.Nullable + public SourceOfFunds getSourceOfFunds() { + return sourceOfFunds; + } + + + public void setSourceOfFunds(SourceOfFunds sourceOfFunds) { + this.sourceOfFunds = sourceOfFunds; + } + + + public TrustCustomerAllOfAttributes taxId(String taxId) { + + this.taxId = taxId; + return this; + } + + /** + * Get taxId + * @return taxId + **/ + @javax.annotation.Nullable + public String getTaxId() { + return taxId; + } + + + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + + public TrustCustomerAllOfAttributes riskRate(RiskRateEnum riskRate) { + + this.riskRate = riskRate; + return this; + } + + /** + * Get riskRate + * @return riskRate + **/ + @javax.annotation.Nullable + public RiskRateEnum getRiskRate() { + return riskRate; + } + + + public void setRiskRate(RiskRateEnum riskRate) { + this.riskRate = riskRate; + } + + + public TrustCustomerAllOfAttributes authorizedUsers(List authorizedUsers) { + + this.authorizedUsers = authorizedUsers; + return this; + } + + public TrustCustomerAllOfAttributes addAuthorizedUsersItem(AuthorizedUser authorizedUsersItem) { + if (this.authorizedUsers == null) { + this.authorizedUsers = new ArrayList<>(); + } + this.authorizedUsers.add(authorizedUsersItem); + return this; + } + + /** + * Get authorizedUsers + * @return authorizedUsers + **/ + @javax.annotation.Nullable + public List getAuthorizedUsers() { + return authorizedUsers; + } + + + public void setAuthorizedUsers(List authorizedUsers) { + this.authorizedUsers = authorizedUsers; + } + + + public TrustCustomerAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public TrustCustomerAllOfAttributes archiveReason(ArchiveReasonEnum archiveReason) { + + this.archiveReason = archiveReason; + return this; + } + + /** + * Get archiveReason + * @return archiveReason + **/ + @javax.annotation.Nullable + public ArchiveReasonEnum getArchiveReason() { + return archiveReason; + } + + + public void setArchiveReason(ArchiveReasonEnum archiveReason) { + this.archiveReason = archiveReason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrustCustomerAllOfAttributes trustCustomerAllOfAttributes = (TrustCustomerAllOfAttributes) o; + return Objects.equals(this.createdAt, trustCustomerAllOfAttributes.createdAt) && + Objects.equals(this.name, trustCustomerAllOfAttributes.name) && + Objects.equals(this.stateOfIncorporation, trustCustomerAllOfAttributes.stateOfIncorporation) && + Objects.equals(this.contact, trustCustomerAllOfAttributes.contact) && + Objects.equals(this.tags, trustCustomerAllOfAttributes.tags) && + Objects.equals(this.revocability, trustCustomerAllOfAttributes.revocability) && + Objects.equals(this.sourceOfFunds, trustCustomerAllOfAttributes.sourceOfFunds) && + Objects.equals(this.taxId, trustCustomerAllOfAttributes.taxId) && + Objects.equals(this.riskRate, trustCustomerAllOfAttributes.riskRate) && + Objects.equals(this.authorizedUsers, trustCustomerAllOfAttributes.authorizedUsers) && + Objects.equals(this.status, trustCustomerAllOfAttributes.status) && + Objects.equals(this.archiveReason, trustCustomerAllOfAttributes.archiveReason); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, name, stateOfIncorporation, contact, tags, revocability, sourceOfFunds, taxId, riskRate, authorizedUsers, status, archiveReason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrustCustomerAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" stateOfIncorporation: ").append(toIndentedString(stateOfIncorporation)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" revocability: ").append(toIndentedString(revocability)).append("\n"); + sb.append(" sourceOfFunds: ").append(toIndentedString(sourceOfFunds)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append(" riskRate: ").append(toIndentedString(riskRate)).append("\n"); + sb.append(" authorizedUsers: ").append(toIndentedString(authorizedUsers)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" archiveReason: ").append(toIndentedString(archiveReason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("name"); + openapiFields.add("stateOfIncorporation"); + openapiFields.add("contact"); + openapiFields.add("tags"); + openapiFields.add("revocability"); + openapiFields.add("sourceOfFunds"); + openapiFields.add("taxId"); + openapiFields.add("riskRate"); + openapiFields.add("authorizedUsers"); + openapiFields.add("status"); + openapiFields.add("archiveReason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("stateOfIncorporation"); + openapiRequiredFields.add("contact"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrustCustomerAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrustCustomerAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TrustCustomerAllOfAttributes is not found in the empty JSON string", TrustCustomerAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrustCustomerAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrustCustomerAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TrustCustomerAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("stateOfIncorporation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stateOfIncorporation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stateOfIncorporation").toString())); + } + // validate the required field `contact` + TrustContact.validateJsonElement(jsonObj.get("contact")); + if ((jsonObj.get("taxId") != null && !jsonObj.get("taxId").isJsonNull()) && !jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + if ((jsonObj.get("riskRate") != null && !jsonObj.get("riskRate").isJsonNull()) && !jsonObj.get("riskRate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `riskRate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskRate").toString())); + } + if (jsonObj.get("authorizedUsers") != null && !jsonObj.get("authorizedUsers").isJsonNull()) { + JsonArray jsonArrayauthorizedUsers = jsonObj.getAsJsonArray("authorizedUsers"); + if (jsonArrayauthorizedUsers != null) { + // ensure the json data is an array + if (!jsonObj.get("authorizedUsers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `authorizedUsers` to be an array in the JSON string but got `%s`", jsonObj.get("authorizedUsers").toString())); + } + + // validate the optional field `authorizedUsers` (array) + for (int i = 0; i < jsonArrayauthorizedUsers.size(); i++) { + AuthorizedUser.validateJsonElement(jsonArrayauthorizedUsers.get(i)); + }; + } + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("archiveReason") != null && !jsonObj.get("archiveReason").isJsonNull()) && !jsonObj.get("archiveReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `archiveReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("archiveReason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrustCustomerAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrustCustomerAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TrustCustomerAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TrustCustomerAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrustCustomerAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TrustCustomerAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrustCustomerAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to TrustCustomerAllOfAttributes + */ + public static TrustCustomerAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrustCustomerAllOfAttributes.class); + } + + /** + * Convert an instance of TrustCustomerAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/Trustee.java b/src/main/java/org/openapitools/client/model/Trustee.java new file mode 100644 index 00000000..bdf80491 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Trustee.java @@ -0,0 +1,466 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.FullName; +import org.openapitools.client.model.Phone; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Trustee + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Trustee { + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private FullName fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_SSN = "ssn"; + @SerializedName(SERIALIZED_NAME_SSN) + private String ssn; + + public static final String SERIALIZED_NAME_PASSPORT = "passport"; + @SerializedName(SERIALIZED_NAME_PASSPORT) + private String passport; + + public static final String SERIALIZED_NAME_NATIONALITY = "nationality"; + @SerializedName(SERIALIZED_NAME_NATIONALITY) + private String nationality; + + public static final String SERIALIZED_NAME_MATRICULA_CONSULAR = "matriculaConsular"; + @SerializedName(SERIALIZED_NAME_MATRICULA_CONSULAR) + private String matriculaConsular; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth"; + @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH) + private LocalDate dateOfBirth; + + public Trustee() { + } + + public Trustee fullName(FullName fullName) { + + this.fullName = fullName; + return this; + } + + /** + * Get fullName + * @return fullName + **/ + @javax.annotation.Nonnull + public FullName getFullName() { + return fullName; + } + + + public void setFullName(FullName fullName) { + this.fullName = fullName; + } + + + public Trustee email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Trustee phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nonnull + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public Trustee ssn(String ssn) { + + this.ssn = ssn; + return this; + } + + /** + * Get ssn + * @return ssn + **/ + @javax.annotation.Nullable + public String getSsn() { + return ssn; + } + + + public void setSsn(String ssn) { + this.ssn = ssn; + } + + + public Trustee passport(String passport) { + + this.passport = passport; + return this; + } + + /** + * Get passport + * @return passport + **/ + @javax.annotation.Nullable + public String getPassport() { + return passport; + } + + + public void setPassport(String passport) { + this.passport = passport; + } + + + public Trustee nationality(String nationality) { + + this.nationality = nationality; + return this; + } + + /** + * Get nationality + * @return nationality + **/ + @javax.annotation.Nullable + public String getNationality() { + return nationality; + } + + + public void setNationality(String nationality) { + this.nationality = nationality; + } + + + public Trustee matriculaConsular(String matriculaConsular) { + + this.matriculaConsular = matriculaConsular; + return this; + } + + /** + * Get matriculaConsular + * @return matriculaConsular + **/ + @javax.annotation.Nullable + public String getMatriculaConsular() { + return matriculaConsular; + } + + + public void setMatriculaConsular(String matriculaConsular) { + this.matriculaConsular = matriculaConsular; + } + + + public Trustee address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public Trustee dateOfBirth(LocalDate dateOfBirth) { + + this.dateOfBirth = dateOfBirth; + return this; + } + + /** + * Get dateOfBirth + * @return dateOfBirth + **/ + @javax.annotation.Nonnull + public LocalDate getDateOfBirth() { + return dateOfBirth; + } + + + public void setDateOfBirth(LocalDate dateOfBirth) { + this.dateOfBirth = dateOfBirth; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Trustee trustee = (Trustee) o; + return Objects.equals(this.fullName, trustee.fullName) && + Objects.equals(this.email, trustee.email) && + Objects.equals(this.phone, trustee.phone) && + Objects.equals(this.ssn, trustee.ssn) && + Objects.equals(this.passport, trustee.passport) && + Objects.equals(this.nationality, trustee.nationality) && + Objects.equals(this.matriculaConsular, trustee.matriculaConsular) && + Objects.equals(this.address, trustee.address) && + Objects.equals(this.dateOfBirth, trustee.dateOfBirth); + } + + @Override + public int hashCode() { + return Objects.hash(fullName, email, phone, ssn, passport, nationality, matriculaConsular, address, dateOfBirth); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Trustee {\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" ssn: ").append(toIndentedString(ssn)).append("\n"); + sb.append(" passport: ").append(toIndentedString(passport)).append("\n"); + sb.append(" nationality: ").append(toIndentedString(nationality)).append("\n"); + sb.append(" matriculaConsular: ").append(toIndentedString(matriculaConsular)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("ssn"); + openapiFields.add("passport"); + openapiFields.add("nationality"); + openapiFields.add("matriculaConsular"); + openapiFields.add("address"); + openapiFields.add("dateOfBirth"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fullName"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("dateOfBirth"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Trustee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Trustee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Trustee is not found in the empty JSON string", Trustee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Trustee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Trustee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Trustee.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fullName` + FullName.validateJsonElement(jsonObj.get("fullName")); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the required field `phone` + Phone.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("ssn") != null && !jsonObj.get("ssn").isJsonNull()) && !jsonObj.get("ssn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ssn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ssn").toString())); + } + if ((jsonObj.get("passport") != null && !jsonObj.get("passport").isJsonNull()) && !jsonObj.get("passport").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `passport` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passport").toString())); + } + if ((jsonObj.get("nationality") != null && !jsonObj.get("nationality").isJsonNull()) && !jsonObj.get("nationality").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nationality` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nationality").toString())); + } + if ((jsonObj.get("matriculaConsular") != null && !jsonObj.get("matriculaConsular").isJsonNull()) && !jsonObj.get("matriculaConsular").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `matriculaConsular` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matriculaConsular").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Trustee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Trustee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Trustee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Trustee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Trustee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Trustee given an JSON string + * + * @param jsonString JSON string + * @return An instance of Trustee + * @throws IOException if the JSON string is invalid with respect to Trustee + */ + public static Trustee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Trustee.class); + } + + /** + * Convert an instance of Trustee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitAccountResponse.java b/src/main/java/org/openapitools/client/model/UnitAccountResponse.java new file mode 100644 index 00000000..f5b387cd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitAccountResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Account; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitAccountResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitAccountResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Account data; + + public UnitAccountResponse() { + } + + public UnitAccountResponse data(Account data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Account getData() { + return data; + } + + + public void setData(Account data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitAccountResponse unitAccountResponse = (UnitAccountResponse) o; + return Objects.equals(this.data, unitAccountResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitAccountResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitAccountResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitAccountResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitAccountResponse is not found in the empty JSON string", UnitAccountResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitAccountResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitAccountResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Account.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitAccountResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitAccountResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitAccountResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitAccountResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitAccountResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitAccountResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitAccountResponse + * @throws IOException if the JSON string is invalid with respect to UnitAccountResponse + */ + public static UnitAccountResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitAccountResponse.class); + } + + /** + * Convert an instance of UnitAccountResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitAccountResponseWithIncluded.java b/src/main/java/org/openapitools/client/model/UnitAccountResponseWithIncluded.java new file mode 100644 index 00000000..9549b703 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitAccountResponseWithIncluded.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Account; +import org.openapitools.client.model.Customer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitAccountResponseWithIncluded + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitAccountResponseWithIncluded { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Account data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitAccountResponseWithIncluded() { + } + + public UnitAccountResponseWithIncluded data(Account data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Account getData() { + return data; + } + + + public void setData(Account data) { + this.data = data; + } + + + public UnitAccountResponseWithIncluded included(List included) { + + this.included = included; + return this; + } + + public UnitAccountResponseWithIncluded addIncludedItem(Customer includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitAccountResponseWithIncluded unitAccountResponseWithIncluded = (UnitAccountResponseWithIncluded) o; + return Objects.equals(this.data, unitAccountResponseWithIncluded.data) && + Objects.equals(this.included, unitAccountResponseWithIncluded.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitAccountResponseWithIncluded {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitAccountResponseWithIncluded + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitAccountResponseWithIncluded.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitAccountResponseWithIncluded is not found in the empty JSON string", UnitAccountResponseWithIncluded.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitAccountResponseWithIncluded.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitAccountResponseWithIncluded` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Account.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + Customer.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitAccountResponseWithIncluded.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitAccountResponseWithIncluded' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitAccountResponseWithIncluded.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitAccountResponseWithIncluded value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitAccountResponseWithIncluded read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitAccountResponseWithIncluded given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitAccountResponseWithIncluded + * @throws IOException if the JSON string is invalid with respect to UnitAccountResponseWithIncluded + */ + public static UnitAccountResponseWithIncluded fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitAccountResponseWithIncluded.class); + } + + /** + * Convert an instance of UnitAccountResponseWithIncluded to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitAccountsListResponse.java b/src/main/java/org/openapitools/client/model/UnitAccountsListResponse.java new file mode 100644 index 00000000..24bf65b8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitAccountsListResponse.java @@ -0,0 +1,314 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Account; +import org.openapitools.client.model.Customer; +import org.openapitools.client.model.PaginationMeta; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitAccountsListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitAccountsListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitAccountsListResponse() { + } + + public UnitAccountsListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitAccountsListResponse addDataItem(Account dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitAccountsListResponse included(List included) { + + this.included = included; + return this; + } + + public UnitAccountsListResponse addIncludedItem(Customer includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + public UnitAccountsListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitAccountsListResponse unitAccountsListResponse = (UnitAccountsListResponse) o; + return Objects.equals(this.data, unitAccountsListResponse.data) && + Objects.equals(this.included, unitAccountsListResponse.included) && + Objects.equals(this.meta, unitAccountsListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitAccountsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitAccountsListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitAccountsListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitAccountsListResponse is not found in the empty JSON string", UnitAccountsListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitAccountsListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitAccountsListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Account.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + Customer.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitAccountsListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitAccountsListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitAccountsListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitAccountsListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitAccountsListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitAccountsListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitAccountsListResponse + * @throws IOException if the JSON string is invalid with respect to UnitAccountsListResponse + */ + public static UnitAccountsListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitAccountsListResponse.class); + } + + /** + * Convert an instance of UnitAccountsListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitApiTokenResponse.java b/src/main/java/org/openapitools/client/model/UnitApiTokenResponse.java new file mode 100644 index 00000000..2f2096b2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitApiTokenResponse.java @@ -0,0 +1,206 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApiToken; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitApiTokenResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitApiTokenResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ApiToken data; + + public UnitApiTokenResponse() { + } + + public UnitApiTokenResponse data(ApiToken data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ApiToken getData() { + return data; + } + + + public void setData(ApiToken data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitApiTokenResponse unitApiTokenResponse = (UnitApiTokenResponse) o; + return Objects.equals(this.data, unitApiTokenResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitApiTokenResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitApiTokenResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitApiTokenResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitApiTokenResponse is not found in the empty JSON string", UnitApiTokenResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitApiTokenResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitApiTokenResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitApiTokenResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitApiTokenResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitApiTokenResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitApiTokenResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitApiTokenResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitApiTokenResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitApiTokenResponse + * @throws IOException if the JSON string is invalid with respect to UnitApiTokenResponse + */ + public static UnitApiTokenResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitApiTokenResponse.class); + } + + /** + * Convert an instance of UnitApiTokenResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitApplicationFormResponse.java b/src/main/java/org/openapitools/client/model/UnitApplicationFormResponse.java new file mode 100644 index 00000000..5a419af8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitApplicationFormResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ApplicationForm; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitApplicationFormResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitApplicationFormResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ApplicationForm data; + + public UnitApplicationFormResponse() { + } + + public UnitApplicationFormResponse data(ApplicationForm data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ApplicationForm getData() { + return data; + } + + + public void setData(ApplicationForm data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitApplicationFormResponse unitApplicationFormResponse = (UnitApplicationFormResponse) o; + return Objects.equals(this.data, unitApplicationFormResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitApplicationFormResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitApplicationFormResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitApplicationFormResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitApplicationFormResponse is not found in the empty JSON string", UnitApplicationFormResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitApplicationFormResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitApplicationFormResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ApplicationForm.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitApplicationFormResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitApplicationFormResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitApplicationFormResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitApplicationFormResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitApplicationFormResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitApplicationFormResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitApplicationFormResponse + * @throws IOException if the JSON string is invalid with respect to UnitApplicationFormResponse + */ + public static UnitApplicationFormResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitApplicationFormResponse.class); + } + + /** + * Convert an instance of UnitApplicationFormResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitApplicationFormResponseWithIncluded.java b/src/main/java/org/openapitools/client/model/UnitApplicationFormResponseWithIncluded.java new file mode 100644 index 00000000..de5887fd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitApplicationFormResponseWithIncluded.java @@ -0,0 +1,243 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.ApplicationForm; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitApplicationFormResponseWithIncluded + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitApplicationFormResponseWithIncluded { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ApplicationForm data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private Application included; + + public UnitApplicationFormResponseWithIncluded() { + } + + public UnitApplicationFormResponseWithIncluded data(ApplicationForm data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ApplicationForm getData() { + return data; + } + + + public void setData(ApplicationForm data) { + this.data = data; + } + + + public UnitApplicationFormResponseWithIncluded included(Application included) { + + this.included = included; + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public Application getIncluded() { + return included; + } + + + public void setIncluded(Application included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitApplicationFormResponseWithIncluded unitApplicationFormResponseWithIncluded = (UnitApplicationFormResponseWithIncluded) o; + return Objects.equals(this.data, unitApplicationFormResponseWithIncluded.data) && + Objects.equals(this.included, unitApplicationFormResponseWithIncluded.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitApplicationFormResponseWithIncluded {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitApplicationFormResponseWithIncluded + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitApplicationFormResponseWithIncluded.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitApplicationFormResponseWithIncluded is not found in the empty JSON string", UnitApplicationFormResponseWithIncluded.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitApplicationFormResponseWithIncluded.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitApplicationFormResponseWithIncluded` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ApplicationForm.validateJsonElement(jsonObj.get("data")); + } + // validate the optional field `included` + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + Application.validateJsonElement(jsonObj.get("included")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitApplicationFormResponseWithIncluded.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitApplicationFormResponseWithIncluded' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitApplicationFormResponseWithIncluded.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitApplicationFormResponseWithIncluded value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitApplicationFormResponseWithIncluded read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitApplicationFormResponseWithIncluded given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitApplicationFormResponseWithIncluded + * @throws IOException if the JSON string is invalid with respect to UnitApplicationFormResponseWithIncluded + */ + public static UnitApplicationFormResponseWithIncluded fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitApplicationFormResponseWithIncluded.class); + } + + /** + * Convert an instance of UnitApplicationFormResponseWithIncluded to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitApplicationFormsListResponse.java b/src/main/java/org/openapitools/client/model/UnitApplicationFormsListResponse.java new file mode 100644 index 00000000..789ab8dd --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitApplicationFormsListResponse.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApplicationForm; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitApplicationFormsListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitApplicationFormsListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public UnitApplicationFormsListResponse() { + } + + public UnitApplicationFormsListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitApplicationFormsListResponse addDataItem(ApplicationForm dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitApplicationFormsListResponse unitApplicationFormsListResponse = (UnitApplicationFormsListResponse) o; + return Objects.equals(this.data, unitApplicationFormsListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitApplicationFormsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitApplicationFormsListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitApplicationFormsListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitApplicationFormsListResponse is not found in the empty JSON string", UnitApplicationFormsListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitApplicationFormsListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitApplicationFormsListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ApplicationForm.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitApplicationFormsListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitApplicationFormsListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitApplicationFormsListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitApplicationFormsListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitApplicationFormsListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitApplicationFormsListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitApplicationFormsListResponse + * @throws IOException if the JSON string is invalid with respect to UnitApplicationFormsListResponse + */ + public static UnitApplicationFormsListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitApplicationFormsListResponse.class); + } + + /** + * Convert an instance of UnitApplicationFormsListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitApplicationResponseWithIncluded.java b/src/main/java/org/openapitools/client/model/UnitApplicationResponseWithIncluded.java new file mode 100644 index 00000000..1805bbdb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitApplicationResponseWithIncluded.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.IncludedResourceInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitApplicationResponseWithIncluded + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitApplicationResponseWithIncluded { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Application data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitApplicationResponseWithIncluded() { + } + + public UnitApplicationResponseWithIncluded data(Application data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Application getData() { + return data; + } + + + public void setData(Application data) { + this.data = data; + } + + + public UnitApplicationResponseWithIncluded included(List included) { + + this.included = included; + return this; + } + + public UnitApplicationResponseWithIncluded addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitApplicationResponseWithIncluded unitApplicationResponseWithIncluded = (UnitApplicationResponseWithIncluded) o; + return Objects.equals(this.data, unitApplicationResponseWithIncluded.data) && + Objects.equals(this.included, unitApplicationResponseWithIncluded.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitApplicationResponseWithIncluded {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitApplicationResponseWithIncluded + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitApplicationResponseWithIncluded.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitApplicationResponseWithIncluded is not found in the empty JSON string", UnitApplicationResponseWithIncluded.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitApplicationResponseWithIncluded.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitApplicationResponseWithIncluded` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Application.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitApplicationResponseWithIncluded.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitApplicationResponseWithIncluded' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitApplicationResponseWithIncluded.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitApplicationResponseWithIncluded value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitApplicationResponseWithIncluded read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitApplicationResponseWithIncluded given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitApplicationResponseWithIncluded + * @throws IOException if the JSON string is invalid with respect to UnitApplicationResponseWithIncluded + */ + public static UnitApplicationResponseWithIncluded fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitApplicationResponseWithIncluded.class); + } + + /** + * Convert an instance of UnitApplicationResponseWithIncluded to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitAuthorizationRequestResponse.java b/src/main/java/org/openapitools/client/model/UnitAuthorizationRequestResponse.java new file mode 100644 index 00000000..f360a37a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitAuthorizationRequestResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitAuthorizationRequestResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitAuthorizationRequestResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AuthorizationRequest data; + + public UnitAuthorizationRequestResponse() { + } + + public UnitAuthorizationRequestResponse data(AuthorizationRequest data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public AuthorizationRequest getData() { + return data; + } + + + public void setData(AuthorizationRequest data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitAuthorizationRequestResponse unitAuthorizationRequestResponse = (UnitAuthorizationRequestResponse) o; + return Objects.equals(this.data, unitAuthorizationRequestResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitAuthorizationRequestResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitAuthorizationRequestResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitAuthorizationRequestResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitAuthorizationRequestResponse is not found in the empty JSON string", UnitAuthorizationRequestResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitAuthorizationRequestResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitAuthorizationRequestResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + AuthorizationRequest.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitAuthorizationRequestResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitAuthorizationRequestResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitAuthorizationRequestResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitAuthorizationRequestResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitAuthorizationRequestResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitAuthorizationRequestResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitAuthorizationRequestResponse + * @throws IOException if the JSON string is invalid with respect to UnitAuthorizationRequestResponse + */ + public static UnitAuthorizationRequestResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitAuthorizationRequestResponse.class); + } + + /** + * Convert an instance of UnitAuthorizationRequestResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitAuthorizationRequestsResponse.java b/src/main/java/org/openapitools/client/model/UnitAuthorizationRequestsResponse.java new file mode 100644 index 00000000..3cf06c72 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitAuthorizationRequestsResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AuthorizationRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitAuthorizationRequestsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitAuthorizationRequestsResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AuthorizationRequest data; + + public UnitAuthorizationRequestsResponse() { + } + + public UnitAuthorizationRequestsResponse data(AuthorizationRequest data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public AuthorizationRequest getData() { + return data; + } + + + public void setData(AuthorizationRequest data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitAuthorizationRequestsResponse unitAuthorizationRequestsResponse = (UnitAuthorizationRequestsResponse) o; + return Objects.equals(this.data, unitAuthorizationRequestsResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitAuthorizationRequestsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitAuthorizationRequestsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitAuthorizationRequestsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitAuthorizationRequestsResponse is not found in the empty JSON string", UnitAuthorizationRequestsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitAuthorizationRequestsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitAuthorizationRequestsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + AuthorizationRequest.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitAuthorizationRequestsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitAuthorizationRequestsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitAuthorizationRequestsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitAuthorizationRequestsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitAuthorizationRequestsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitAuthorizationRequestsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitAuthorizationRequestsResponse + * @throws IOException if the JSON string is invalid with respect to UnitAuthorizationRequestsResponse + */ + public static UnitAuthorizationRequestsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitAuthorizationRequestsResponse.class); + } + + /** + * Convert an instance of UnitAuthorizationRequestsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitAuthorizationResponse.java b/src/main/java/org/openapitools/client/model/UnitAuthorizationResponse.java new file mode 100644 index 00000000..6ea51ba1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitAuthorizationResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Authorization; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitAuthorizationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitAuthorizationResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Authorization data; + + public UnitAuthorizationResponse() { + } + + public UnitAuthorizationResponse data(Authorization data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Authorization getData() { + return data; + } + + + public void setData(Authorization data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitAuthorizationResponse unitAuthorizationResponse = (UnitAuthorizationResponse) o; + return Objects.equals(this.data, unitAuthorizationResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitAuthorizationResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitAuthorizationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitAuthorizationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitAuthorizationResponse is not found in the empty JSON string", UnitAuthorizationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitAuthorizationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitAuthorizationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Authorization.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitAuthorizationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitAuthorizationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitAuthorizationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitAuthorizationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitAuthorizationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitAuthorizationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitAuthorizationResponse + * @throws IOException if the JSON string is invalid with respect to UnitAuthorizationResponse + */ + public static UnitAuthorizationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitAuthorizationResponse.class); + } + + /** + * Convert an instance of UnitAuthorizationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCancelApplicationResponse.java b/src/main/java/org/openapitools/client/model/UnitCancelApplicationResponse.java new file mode 100644 index 00000000..f5d696b1 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCancelApplicationResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.Document; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCancelApplicationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCancelApplicationResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Application data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitCancelApplicationResponse() { + } + + public UnitCancelApplicationResponse data(Application data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Application getData() { + return data; + } + + + public void setData(Application data) { + this.data = data; + } + + + public UnitCancelApplicationResponse included(List included) { + + this.included = included; + return this; + } + + public UnitCancelApplicationResponse addIncludedItem(Document includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCancelApplicationResponse unitCancelApplicationResponse = (UnitCancelApplicationResponse) o; + return Objects.equals(this.data, unitCancelApplicationResponse.data) && + Objects.equals(this.included, unitCancelApplicationResponse.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCancelApplicationResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCancelApplicationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCancelApplicationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCancelApplicationResponse is not found in the empty JSON string", UnitCancelApplicationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCancelApplicationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCancelApplicationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Application.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + Document.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCancelApplicationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCancelApplicationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCancelApplicationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCancelApplicationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCancelApplicationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCancelApplicationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCancelApplicationResponse + * @throws IOException if the JSON string is invalid with respect to UnitCancelApplicationResponse + */ + public static UnitCancelApplicationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCancelApplicationResponse.class); + } + + /** + * Convert an instance of UnitCancelApplicationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCardResponse.java b/src/main/java/org/openapitools/client/model/UnitCardResponse.java new file mode 100644 index 00000000..71e21203 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCardResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Card; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCardResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCardResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Card data; + + public UnitCardResponse() { + } + + public UnitCardResponse data(Card data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Card getData() { + return data; + } + + + public void setData(Card data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCardResponse unitCardResponse = (UnitCardResponse) o; + return Objects.equals(this.data, unitCardResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCardResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCardResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCardResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCardResponse is not found in the empty JSON string", UnitCardResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCardResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCardResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Card.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCardResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCardResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCardResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCardResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCardResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCardResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCardResponse + * @throws IOException if the JSON string is invalid with respect to UnitCardResponse + */ + public static UnitCardResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCardResponse.class); + } + + /** + * Convert an instance of UnitCardResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCardResponse1.java b/src/main/java/org/openapitools/client/model/UnitCardResponse1.java new file mode 100644 index 00000000..7e69c412 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCardResponse1.java @@ -0,0 +1,253 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.IncludedResourceInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCardResponse1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCardResponse1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Card data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List> included; + + public UnitCardResponse1() { + } + + public UnitCardResponse1 data(Card data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Card getData() { + return data; + } + + + public void setData(Card data) { + this.data = data; + } + + + public UnitCardResponse1 included(List> included) { + + this.included = included; + return this; + } + + public UnitCardResponse1 addIncludedItem(List includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List> getIncluded() { + return included; + } + + + public void setIncluded(List> included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCardResponse1 unitCardResponse1 = (UnitCardResponse1) o; + return Objects.equals(this.data, unitCardResponse1.data) && + Objects.equals(this.included, unitCardResponse1.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCardResponse1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCardResponse1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCardResponse1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCardResponse1 is not found in the empty JSON string", UnitCardResponse1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCardResponse1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCardResponse1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Card.validateJsonElement(jsonObj.get("data")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull() && !jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCardResponse1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCardResponse1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCardResponse1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCardResponse1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCardResponse1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCardResponse1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCardResponse1 + * @throws IOException if the JSON string is invalid with respect to UnitCardResponse1 + */ + public static UnitCardResponse1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCardResponse1.class); + } + + /** + * Convert an instance of UnitCardResponse1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCardResponse2.java b/src/main/java/org/openapitools/client/model/UnitCardResponse2.java new file mode 100644 index 00000000..aa02f330 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCardResponse2.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PinStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCardResponse2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCardResponse2 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private PinStatus data; + + public UnitCardResponse2() { + } + + public UnitCardResponse2 data(PinStatus data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public PinStatus getData() { + return data; + } + + + public void setData(PinStatus data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCardResponse2 unitCardResponse2 = (UnitCardResponse2) o; + return Objects.equals(this.data, unitCardResponse2.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCardResponse2 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCardResponse2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCardResponse2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCardResponse2 is not found in the empty JSON string", UnitCardResponse2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCardResponse2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCardResponse2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + PinStatus.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCardResponse2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCardResponse2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCardResponse2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCardResponse2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCardResponse2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCardResponse2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCardResponse2 + * @throws IOException if the JSON string is invalid with respect to UnitCardResponse2 + */ + public static UnitCardResponse2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCardResponse2.class); + } + + /** + * Convert an instance of UnitCardResponse2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCardResponse3.java b/src/main/java/org/openapitools/client/model/UnitCardResponse3.java new file mode 100644 index 00000000..64826e69 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCardResponse3.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Limits1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCardResponse3 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCardResponse3 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Limits1 data; + + public UnitCardResponse3() { + } + + public UnitCardResponse3 data(Limits1 data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Limits1 getData() { + return data; + } + + + public void setData(Limits1 data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCardResponse3 unitCardResponse3 = (UnitCardResponse3) o; + return Objects.equals(this.data, unitCardResponse3.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCardResponse3 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCardResponse3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCardResponse3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCardResponse3 is not found in the empty JSON string", UnitCardResponse3.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCardResponse3.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCardResponse3` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Limits1.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCardResponse3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCardResponse3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCardResponse3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCardResponse3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCardResponse3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCardResponse3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCardResponse3 + * @throws IOException if the JSON string is invalid with respect to UnitCardResponse3 + */ + public static UnitCardResponse3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCardResponse3.class); + } + + /** + * Convert an instance of UnitCardResponse3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCardResponseCardsList.java b/src/main/java/org/openapitools/client/model/UnitCardResponseCardsList.java new file mode 100644 index 00000000..a154f014 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCardResponseCardsList.java @@ -0,0 +1,271 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Card; +import org.openapitools.client.model.IncludedResourceInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCardResponseCardsList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCardResponseCardsList { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List> included; + + public UnitCardResponseCardsList() { + } + + public UnitCardResponseCardsList data(List data) { + + this.data = data; + return this; + } + + public UnitCardResponseCardsList addDataItem(Card dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitCardResponseCardsList included(List> included) { + + this.included = included; + return this; + } + + public UnitCardResponseCardsList addIncludedItem(List includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List> getIncluded() { + return included; + } + + + public void setIncluded(List> included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCardResponseCardsList unitCardResponseCardsList = (UnitCardResponseCardsList) o; + return Objects.equals(this.data, unitCardResponseCardsList.data) && + Objects.equals(this.included, unitCardResponseCardsList.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCardResponseCardsList {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCardResponseCardsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCardResponseCardsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCardResponseCardsList is not found in the empty JSON string", UnitCardResponseCardsList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCardResponseCardsList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCardResponseCardsList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Card.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull() && !jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCardResponseCardsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCardResponseCardsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCardResponseCardsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCardResponseCardsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCardResponseCardsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCardResponseCardsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCardResponseCardsList + * @throws IOException if the JSON string is invalid with respect to UnitCardResponseCardsList + */ + public static UnitCardResponseCardsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCardResponseCardsList.class); + } + + /** + * Convert an instance of UnitCardResponseCardsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCheckDepositResponse.java b/src/main/java/org/openapitools/client/model/UnitCheckDepositResponse.java new file mode 100644 index 00000000..935be366 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCheckDepositResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckDeposit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCheckDepositResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCheckDepositResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CheckDeposit data; + + public UnitCheckDepositResponse() { + } + + public UnitCheckDepositResponse data(CheckDeposit data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CheckDeposit getData() { + return data; + } + + + public void setData(CheckDeposit data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCheckDepositResponse unitCheckDepositResponse = (UnitCheckDepositResponse) o; + return Objects.equals(this.data, unitCheckDepositResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCheckDepositResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCheckDepositResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCheckDepositResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCheckDepositResponse is not found in the empty JSON string", UnitCheckDepositResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCheckDepositResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCheckDepositResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CheckDeposit.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCheckDepositResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCheckDepositResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCheckDepositResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCheckDepositResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCheckDepositResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCheckDepositResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCheckDepositResponse + * @throws IOException if the JSON string is invalid with respect to UnitCheckDepositResponse + */ + public static UnitCheckDepositResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCheckDepositResponse.class); + } + + /** + * Convert an instance of UnitCheckDepositResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCheckDepositResponse1.java b/src/main/java/org/openapitools/client/model/UnitCheckDepositResponse1.java new file mode 100644 index 00000000..6634fdf3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCheckDepositResponse1.java @@ -0,0 +1,208 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCheckDepositResponse1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCheckDepositResponse1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private String data; + + public UnitCheckDepositResponse1() { + } + + public UnitCheckDepositResponse1 data(String data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public String getData() { + return data; + } + + + public void setData(String data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCheckDepositResponse1 unitCheckDepositResponse1 = (UnitCheckDepositResponse1) o; + return Objects.equals(this.data, unitCheckDepositResponse1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCheckDepositResponse1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCheckDepositResponse1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCheckDepositResponse1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCheckDepositResponse1 is not found in the empty JSON string", UnitCheckDepositResponse1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCheckDepositResponse1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCheckDepositResponse1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) && !jsonObj.get("data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCheckDepositResponse1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCheckDepositResponse1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCheckDepositResponse1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCheckDepositResponse1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCheckDepositResponse1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCheckDepositResponse1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCheckDepositResponse1 + * @throws IOException if the JSON string is invalid with respect to UnitCheckDepositResponse1 + */ + public static UnitCheckDepositResponse1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCheckDepositResponse1.class); + } + + /** + * Convert an instance of UnitCheckDepositResponse1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCheckPaymentResponse.java b/src/main/java/org/openapitools/client/model/UnitCheckPaymentResponse.java new file mode 100644 index 00000000..6a71935a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCheckPaymentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CheckPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCheckPaymentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCheckPaymentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CheckPayment data; + + public UnitCheckPaymentResponse() { + } + + public UnitCheckPaymentResponse data(CheckPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CheckPayment getData() { + return data; + } + + + public void setData(CheckPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCheckPaymentResponse unitCheckPaymentResponse = (UnitCheckPaymentResponse) o; + return Objects.equals(this.data, unitCheckPaymentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCheckPaymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCheckPaymentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCheckPaymentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCheckPaymentResponse is not found in the empty JSON string", UnitCheckPaymentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCheckPaymentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCheckPaymentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CheckPayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCheckPaymentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCheckPaymentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCheckPaymentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCheckPaymentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCheckPaymentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCheckPaymentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCheckPaymentResponse + * @throws IOException if the JSON string is invalid with respect to UnitCheckPaymentResponse + */ + public static UnitCheckPaymentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCheckPaymentResponse.class); + } + + /** + * Convert an instance of UnitCheckPaymentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCounterpartiesListResponse.java b/src/main/java/org/openapitools/client/model/UnitCounterpartiesListResponse.java new file mode 100644 index 00000000..8866c6b8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCounterpartiesListResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCounterpartiesListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCounterpartiesListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Counterparty1 data; + + public UnitCounterpartiesListResponse() { + } + + public UnitCounterpartiesListResponse data(Counterparty1 data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Counterparty1 getData() { + return data; + } + + + public void setData(Counterparty1 data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCounterpartiesListResponse unitCounterpartiesListResponse = (UnitCounterpartiesListResponse) o; + return Objects.equals(this.data, unitCounterpartiesListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCounterpartiesListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCounterpartiesListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCounterpartiesListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCounterpartiesListResponse is not found in the empty JSON string", UnitCounterpartiesListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCounterpartiesListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCounterpartiesListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Counterparty1.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCounterpartiesListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCounterpartiesListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCounterpartiesListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCounterpartiesListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCounterpartiesListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCounterpartiesListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCounterpartiesListResponse + * @throws IOException if the JSON string is invalid with respect to UnitCounterpartiesListResponse + */ + public static UnitCounterpartiesListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCounterpartiesListResponse.class); + } + + /** + * Convert an instance of UnitCounterpartiesListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCounterpartyResponse.java b/src/main/java/org/openapitools/client/model/UnitCounterpartyResponse.java new file mode 100644 index 00000000..2a758dc3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCounterpartyResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCounterpartyResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCounterpartyResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Counterparty1 data; + + public UnitCounterpartyResponse() { + } + + public UnitCounterpartyResponse data(Counterparty1 data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Counterparty1 getData() { + return data; + } + + + public void setData(Counterparty1 data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCounterpartyResponse unitCounterpartyResponse = (UnitCounterpartyResponse) o; + return Objects.equals(this.data, unitCounterpartyResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCounterpartyResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCounterpartyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCounterpartyResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCounterpartyResponse is not found in the empty JSON string", UnitCounterpartyResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCounterpartyResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCounterpartyResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Counterparty1.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCounterpartyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCounterpartyResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCounterpartyResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCounterpartyResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCounterpartyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCounterpartyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCounterpartyResponse + * @throws IOException if the JSON string is invalid with respect to UnitCounterpartyResponse + */ + public static UnitCounterpartyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCounterpartyResponse.class); + } + + /** + * Convert an instance of UnitCounterpartyResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCounterpartyResponse1.java b/src/main/java/org/openapitools/client/model/UnitCounterpartyResponse1.java new file mode 100644 index 00000000..630ac66a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCounterpartyResponse1.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CounterpartyBalance; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCounterpartyResponse1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCounterpartyResponse1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CounterpartyBalance data; + + public UnitCounterpartyResponse1() { + } + + public UnitCounterpartyResponse1 data(CounterpartyBalance data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CounterpartyBalance getData() { + return data; + } + + + public void setData(CounterpartyBalance data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCounterpartyResponse1 unitCounterpartyResponse1 = (UnitCounterpartyResponse1) o; + return Objects.equals(this.data, unitCounterpartyResponse1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCounterpartyResponse1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCounterpartyResponse1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCounterpartyResponse1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCounterpartyResponse1 is not found in the empty JSON string", UnitCounterpartyResponse1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCounterpartyResponse1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCounterpartyResponse1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CounterpartyBalance.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCounterpartyResponse1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCounterpartyResponse1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCounterpartyResponse1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCounterpartyResponse1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCounterpartyResponse1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCounterpartyResponse1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCounterpartyResponse1 + * @throws IOException if the JSON string is invalid with respect to UnitCounterpartyResponse1 + */ + public static UnitCounterpartyResponse1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCounterpartyResponse1.class); + } + + /** + * Convert an instance of UnitCounterpartyResponse1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCreateApplicationResponse.java b/src/main/java/org/openapitools/client/model/UnitCreateApplicationResponse.java new file mode 100644 index 00000000..411355b4 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCreateApplicationResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.Document; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCreateApplicationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCreateApplicationResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Application data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitCreateApplicationResponse() { + } + + public UnitCreateApplicationResponse data(Application data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Application getData() { + return data; + } + + + public void setData(Application data) { + this.data = data; + } + + + public UnitCreateApplicationResponse included(List included) { + + this.included = included; + return this; + } + + public UnitCreateApplicationResponse addIncludedItem(Document includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCreateApplicationResponse unitCreateApplicationResponse = (UnitCreateApplicationResponse) o; + return Objects.equals(this.data, unitCreateApplicationResponse.data) && + Objects.equals(this.included, unitCreateApplicationResponse.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCreateApplicationResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCreateApplicationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCreateApplicationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCreateApplicationResponse is not found in the empty JSON string", UnitCreateApplicationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCreateApplicationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCreateApplicationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Application.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + Document.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCreateApplicationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCreateApplicationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCreateApplicationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCreateApplicationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCreateApplicationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCreateApplicationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCreateApplicationResponse + * @throws IOException if the JSON string is invalid with respect to UnitCreateApplicationResponse + */ + public static UnitCreateApplicationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCreateApplicationResponse.class); + } + + /** + * Convert an instance of UnitCreateApplicationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCustomerResponse.java b/src/main/java/org/openapitools/client/model/UnitCustomerResponse.java new file mode 100644 index 00000000..6884cd22 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCustomerResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Customer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCustomerResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCustomerResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Customer data; + + public UnitCustomerResponse() { + } + + public UnitCustomerResponse data(Customer data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Customer getData() { + return data; + } + + + public void setData(Customer data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCustomerResponse unitCustomerResponse = (UnitCustomerResponse) o; + return Objects.equals(this.data, unitCustomerResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCustomerResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCustomerResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCustomerResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCustomerResponse is not found in the empty JSON string", UnitCustomerResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCustomerResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCustomerResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Customer.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCustomerResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCustomerResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCustomerResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCustomerResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCustomerResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCustomerResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCustomerResponse + * @throws IOException if the JSON string is invalid with respect to UnitCustomerResponse + */ + public static UnitCustomerResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCustomerResponse.class); + } + + /** + * Convert an instance of UnitCustomerResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCustomerTokenResponse.java b/src/main/java/org/openapitools/client/model/UnitCustomerTokenResponse.java new file mode 100644 index 00000000..b4447d2f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCustomerTokenResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerToken; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCustomerTokenResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCustomerTokenResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CustomerToken data; + + public UnitCustomerTokenResponse() { + } + + public UnitCustomerTokenResponse data(CustomerToken data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CustomerToken getData() { + return data; + } + + + public void setData(CustomerToken data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCustomerTokenResponse unitCustomerTokenResponse = (UnitCustomerTokenResponse) o; + return Objects.equals(this.data, unitCustomerTokenResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCustomerTokenResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCustomerTokenResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCustomerTokenResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCustomerTokenResponse is not found in the empty JSON string", UnitCustomerTokenResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCustomerTokenResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCustomerTokenResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CustomerToken.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCustomerTokenResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCustomerTokenResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCustomerTokenResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCustomerTokenResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCustomerTokenResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCustomerTokenResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCustomerTokenResponse + * @throws IOException if the JSON string is invalid with respect to UnitCustomerTokenResponse + */ + public static UnitCustomerTokenResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCustomerTokenResponse.class); + } + + /** + * Convert an instance of UnitCustomerTokenResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCustomerTokenVerificationResponse.java b/src/main/java/org/openapitools/client/model/UnitCustomerTokenVerificationResponse.java new file mode 100644 index 00000000..59e43ae5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCustomerTokenVerificationResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.CustomerTokenVerification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCustomerTokenVerificationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCustomerTokenVerificationResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private CustomerTokenVerification data; + + public UnitCustomerTokenVerificationResponse() { + } + + public UnitCustomerTokenVerificationResponse data(CustomerTokenVerification data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public CustomerTokenVerification getData() { + return data; + } + + + public void setData(CustomerTokenVerification data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCustomerTokenVerificationResponse unitCustomerTokenVerificationResponse = (UnitCustomerTokenVerificationResponse) o; + return Objects.equals(this.data, unitCustomerTokenVerificationResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCustomerTokenVerificationResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCustomerTokenVerificationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCustomerTokenVerificationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCustomerTokenVerificationResponse is not found in the empty JSON string", UnitCustomerTokenVerificationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCustomerTokenVerificationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCustomerTokenVerificationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + CustomerTokenVerification.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCustomerTokenVerificationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCustomerTokenVerificationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCustomerTokenVerificationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCustomerTokenVerificationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCustomerTokenVerificationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCustomerTokenVerificationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCustomerTokenVerificationResponse + * @throws IOException if the JSON string is invalid with respect to UnitCustomerTokenVerificationResponse + */ + public static UnitCustomerTokenVerificationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCustomerTokenVerificationResponse.class); + } + + /** + * Convert an instance of UnitCustomerTokenVerificationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitCustomersListResponse.java b/src/main/java/org/openapitools/client/model/UnitCustomersListResponse.java new file mode 100644 index 00000000..e613fab3 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitCustomersListResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Customer; +import org.openapitools.client.model.PaginationMeta; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitCustomersListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitCustomersListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitCustomersListResponse() { + } + + public UnitCustomersListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitCustomersListResponse addDataItem(Customer dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitCustomersListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitCustomersListResponse unitCustomersListResponse = (UnitCustomersListResponse) o; + return Objects.equals(this.data, unitCustomersListResponse.data) && + Objects.equals(this.meta, unitCustomersListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitCustomersListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitCustomersListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitCustomersListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitCustomersListResponse is not found in the empty JSON string", UnitCustomersListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitCustomersListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitCustomersListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Customer.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitCustomersListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitCustomersListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitCustomersListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitCustomersListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitCustomersListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitCustomersListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitCustomersListResponse + * @throws IOException if the JSON string is invalid with respect to UnitCustomersListResponse + */ + public static UnitCustomersListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitCustomersListResponse.class); + } + + /** + * Convert an instance of UnitCustomersListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitDisputeResponse.java b/src/main/java/org/openapitools/client/model/UnitDisputeResponse.java new file mode 100644 index 00000000..ad2af87b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitDisputeResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Dispute; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitDisputeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitDisputeResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Dispute data; + + public UnitDisputeResponse() { + } + + public UnitDisputeResponse data(Dispute data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Dispute getData() { + return data; + } + + + public void setData(Dispute data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitDisputeResponse unitDisputeResponse = (UnitDisputeResponse) o; + return Objects.equals(this.data, unitDisputeResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitDisputeResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitDisputeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitDisputeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitDisputeResponse is not found in the empty JSON string", UnitDisputeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitDisputeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitDisputeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Dispute.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitDisputeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitDisputeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitDisputeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitDisputeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitDisputeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitDisputeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitDisputeResponse + * @throws IOException if the JSON string is invalid with respect to UnitDisputeResponse + */ + public static UnitDisputeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitDisputeResponse.class); + } + + /** + * Convert an instance of UnitDisputeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitDocumentResponse.java b/src/main/java/org/openapitools/client/model/UnitDocumentResponse.java new file mode 100644 index 00000000..508f438b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitDocumentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Document; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitDocumentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitDocumentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Document data; + + public UnitDocumentResponse() { + } + + public UnitDocumentResponse data(Document data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Document getData() { + return data; + } + + + public void setData(Document data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitDocumentResponse unitDocumentResponse = (UnitDocumentResponse) o; + return Objects.equals(this.data, unitDocumentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitDocumentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitDocumentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitDocumentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitDocumentResponse is not found in the empty JSON string", UnitDocumentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitDocumentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitDocumentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Document.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitDocumentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitDocumentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitDocumentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitDocumentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitDocumentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitDocumentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitDocumentResponse + * @throws IOException if the JSON string is invalid with respect to UnitDocumentResponse + */ + public static UnitDocumentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitDocumentResponse.class); + } + + /** + * Convert an instance of UnitDocumentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitEventListResponse.java b/src/main/java/org/openapitools/client/model/UnitEventListResponse.java new file mode 100644 index 00000000..bdfbe6f8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitEventListResponse.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Event; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitEventListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitEventListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public UnitEventListResponse() { + } + + public UnitEventListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitEventListResponse addDataItem(Event dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitEventListResponse unitEventListResponse = (UnitEventListResponse) o; + return Objects.equals(this.data, unitEventListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitEventListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitEventListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitEventListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitEventListResponse is not found in the empty JSON string", UnitEventListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitEventListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitEventListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Event.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitEventListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitEventListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitEventListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitEventListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitEventListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitEventListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitEventListResponse + * @throws IOException if the JSON string is invalid with respect to UnitEventListResponse + */ + public static UnitEventListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitEventListResponse.class); + } + + /** + * Convert an instance of UnitEventListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitEventResponse.java b/src/main/java/org/openapitools/client/model/UnitEventResponse.java new file mode 100644 index 00000000..54894403 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitEventResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Event; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitEventResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitEventResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Event data; + + public UnitEventResponse() { + } + + public UnitEventResponse data(Event data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Event getData() { + return data; + } + + + public void setData(Event data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitEventResponse unitEventResponse = (UnitEventResponse) o; + return Objects.equals(this.data, unitEventResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitEventResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitEventResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitEventResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitEventResponse is not found in the empty JSON string", UnitEventResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitEventResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitEventResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Event.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitEventResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitEventResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitEventResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitEventResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitEventResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitEventResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitEventResponse + * @throws IOException if the JSON string is invalid with respect to UnitEventResponse + */ + public static UnitEventResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitEventResponse.class); + } + + /** + * Convert an instance of UnitEventResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitEventResponse1.java b/src/main/java/org/openapitools/client/model/UnitEventResponse1.java new file mode 100644 index 00000000..b77e56b2 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitEventResponse1.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Event; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitEventResponse1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitEventResponse1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Event data; + + public UnitEventResponse1() { + } + + public UnitEventResponse1 data(Event data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Event getData() { + return data; + } + + + public void setData(Event data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitEventResponse1 unitEventResponse1 = (UnitEventResponse1) o; + return Objects.equals(this.data, unitEventResponse1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitEventResponse1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitEventResponse1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitEventResponse1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitEventResponse1 is not found in the empty JSON string", UnitEventResponse1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitEventResponse1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitEventResponse1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Event.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitEventResponse1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitEventResponse1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitEventResponse1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitEventResponse1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitEventResponse1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitEventResponse1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitEventResponse1 + * @throws IOException if the JSON string is invalid with respect to UnitEventResponse1 + */ + public static UnitEventResponse1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitEventResponse1.class); + } + + /** + * Convert an instance of UnitEventResponse1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitFeeResponse.java b/src/main/java/org/openapitools/client/model/UnitFeeResponse.java new file mode 100644 index 00000000..853a6b88 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitFeeResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Fee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitFeeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitFeeResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Fee data; + + public UnitFeeResponse() { + } + + public UnitFeeResponse data(Fee data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Fee getData() { + return data; + } + + + public void setData(Fee data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitFeeResponse unitFeeResponse = (UnitFeeResponse) o; + return Objects.equals(this.data, unitFeeResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitFeeResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitFeeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitFeeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitFeeResponse is not found in the empty JSON string", UnitFeeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitFeeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitFeeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Fee.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitFeeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitFeeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitFeeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitFeeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitFeeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitFeeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitFeeResponse + * @throws IOException if the JSON string is invalid with respect to UnitFeeResponse + */ + public static UnitFeeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitFeeResponse.class); + } + + /** + * Convert an instance of UnitFeeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitGetAccountEndOfDayListResponse.java b/src/main/java/org/openapitools/client/model/UnitGetAccountEndOfDayListResponse.java new file mode 100644 index 00000000..7a5eb0e9 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitGetAccountEndOfDayListResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.AccountEndOfDay; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitGetAccountEndOfDayListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitGetAccountEndOfDayListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private AccountEndOfDay data; + + public UnitGetAccountEndOfDayListResponse() { + } + + public UnitGetAccountEndOfDayListResponse data(AccountEndOfDay data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public AccountEndOfDay getData() { + return data; + } + + + public void setData(AccountEndOfDay data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitGetAccountEndOfDayListResponse unitGetAccountEndOfDayListResponse = (UnitGetAccountEndOfDayListResponse) o; + return Objects.equals(this.data, unitGetAccountEndOfDayListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitGetAccountEndOfDayListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitGetAccountEndOfDayListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitGetAccountEndOfDayListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitGetAccountEndOfDayListResponse is not found in the empty JSON string", UnitGetAccountEndOfDayListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitGetAccountEndOfDayListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitGetAccountEndOfDayListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + AccountEndOfDay.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitGetAccountEndOfDayListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitGetAccountEndOfDayListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitGetAccountEndOfDayListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitGetAccountEndOfDayListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitGetAccountEndOfDayListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitGetAccountEndOfDayListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitGetAccountEndOfDayListResponse + * @throws IOException if the JSON string is invalid with respect to UnitGetAccountEndOfDayListResponse + */ + public static UnitGetAccountEndOfDayListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitGetAccountEndOfDayListResponse.class); + } + + /** + * Convert an instance of UnitGetAccountEndOfDayListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitGetAccountLimitsResponse.java b/src/main/java/org/openapitools/client/model/UnitGetAccountLimitsResponse.java new file mode 100644 index 00000000..009fac08 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitGetAccountLimitsResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Limits; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitGetAccountLimitsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitGetAccountLimitsResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Limits data; + + public UnitGetAccountLimitsResponse() { + } + + public UnitGetAccountLimitsResponse data(Limits data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Limits getData() { + return data; + } + + + public void setData(Limits data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitGetAccountLimitsResponse unitGetAccountLimitsResponse = (UnitGetAccountLimitsResponse) o; + return Objects.equals(this.data, unitGetAccountLimitsResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitGetAccountLimitsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitGetAccountLimitsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitGetAccountLimitsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitGetAccountLimitsResponse is not found in the empty JSON string", UnitGetAccountLimitsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitGetAccountLimitsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitGetAccountLimitsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Limits.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitGetAccountLimitsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitGetAccountLimitsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitGetAccountLimitsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitGetAccountLimitsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitGetAccountLimitsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitGetAccountLimitsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitGetAccountLimitsResponse + * @throws IOException if the JSON string is invalid with respect to UnitGetAccountLimitsResponse + */ + public static UnitGetAccountLimitsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitGetAccountLimitsResponse.class); + } + + /** + * Convert an instance of UnitGetAccountLimitsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitInstitutionResponse.java b/src/main/java/org/openapitools/client/model/UnitInstitutionResponse.java new file mode 100644 index 00000000..bc04a686 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitInstitutionResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Institution; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitInstitutionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitInstitutionResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Institution data; + + public UnitInstitutionResponse() { + } + + public UnitInstitutionResponse data(Institution data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Institution getData() { + return data; + } + + + public void setData(Institution data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitInstitutionResponse unitInstitutionResponse = (UnitInstitutionResponse) o; + return Objects.equals(this.data, unitInstitutionResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitInstitutionResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitInstitutionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitInstitutionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitInstitutionResponse is not found in the empty JSON string", UnitInstitutionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitInstitutionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitInstitutionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Institution.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitInstitutionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitInstitutionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitInstitutionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitInstitutionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitInstitutionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitInstitutionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitInstitutionResponse + * @throws IOException if the JSON string is invalid with respect to UnitInstitutionResponse + */ + public static UnitInstitutionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitInstitutionResponse.class); + } + + /** + * Convert an instance of UnitInstitutionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitListApplicationsResponse.java b/src/main/java/org/openapitools/client/model/UnitListApplicationsResponse.java new file mode 100644 index 00000000..7c63fa1a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitListApplicationsResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Application; +import org.openapitools.client.model.PaginationMeta; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitListApplicationsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitListApplicationsResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitListApplicationsResponse() { + } + + public UnitListApplicationsResponse data(List data) { + + this.data = data; + return this; + } + + public UnitListApplicationsResponse addDataItem(Application dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitListApplicationsResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitListApplicationsResponse unitListApplicationsResponse = (UnitListApplicationsResponse) o; + return Objects.equals(this.data, unitListApplicationsResponse.data) && + Objects.equals(this.meta, unitListApplicationsResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitListApplicationsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitListApplicationsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitListApplicationsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitListApplicationsResponse is not found in the empty JSON string", UnitListApplicationsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitListApplicationsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitListApplicationsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Application.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitListApplicationsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitListApplicationsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitListApplicationsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitListApplicationsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitListApplicationsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitListApplicationsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitListApplicationsResponse + * @throws IOException if the JSON string is invalid with respect to UnitListApplicationsResponse + */ + public static UnitListApplicationsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitListApplicationsResponse.class); + } + + /** + * Convert an instance of UnitListApplicationsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitOrgApiTokensListResponse.java b/src/main/java/org/openapitools/client/model/UnitOrgApiTokensListResponse.java new file mode 100644 index 00000000..cbb8fd83 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitOrgApiTokensListResponse.java @@ -0,0 +1,220 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ApiToken; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitOrgApiTokensListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitOrgApiTokensListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public UnitOrgApiTokensListResponse() { + } + + public UnitOrgApiTokensListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitOrgApiTokensListResponse addDataItem(ApiToken dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitOrgApiTokensListResponse unitOrgApiTokensListResponse = (UnitOrgApiTokensListResponse) o; + return Objects.equals(this.data, unitOrgApiTokensListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitOrgApiTokensListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitOrgApiTokensListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitOrgApiTokensListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitOrgApiTokensListResponse is not found in the empty JSON string", UnitOrgApiTokensListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitOrgApiTokensListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitOrgApiTokensListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull() && !jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitOrgApiTokensListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitOrgApiTokensListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitOrgApiTokensListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitOrgApiTokensListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitOrgApiTokensListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitOrgApiTokensListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitOrgApiTokensListResponse + * @throws IOException if the JSON string is invalid with respect to UnitOrgApiTokensListResponse + */ + public static UnitOrgApiTokensListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitOrgApiTokensListResponse.class); + } + + /** + * Convert an instance of UnitOrgApiTokensListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitPaymentResponse.java b/src/main/java/org/openapitools/client/model/UnitPaymentResponse.java new file mode 100644 index 00000000..d6b65374 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitPaymentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Payment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitPaymentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitPaymentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Payment data; + + public UnitPaymentResponse() { + } + + public UnitPaymentResponse data(Payment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Payment getData() { + return data; + } + + + public void setData(Payment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitPaymentResponse unitPaymentResponse = (UnitPaymentResponse) o; + return Objects.equals(this.data, unitPaymentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitPaymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitPaymentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitPaymentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitPaymentResponse is not found in the empty JSON string", UnitPaymentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitPaymentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitPaymentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Payment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitPaymentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitPaymentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitPaymentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitPaymentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitPaymentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitPaymentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitPaymentResponse + * @throws IOException if the JSON string is invalid with respect to UnitPaymentResponse + */ + public static UnitPaymentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitPaymentResponse.class); + } + + /** + * Convert an instance of UnitPaymentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitPaymentResponseWithIncluded.java b/src/main/java/org/openapitools/client/model/UnitPaymentResponseWithIncluded.java new file mode 100644 index 00000000..12428202 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitPaymentResponseWithIncluded.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.IncludedResourceInner; +import org.openapitools.client.model.Payment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitPaymentResponseWithIncluded + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitPaymentResponseWithIncluded { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Payment data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitPaymentResponseWithIncluded() { + } + + public UnitPaymentResponseWithIncluded data(Payment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Payment getData() { + return data; + } + + + public void setData(Payment data) { + this.data = data; + } + + + public UnitPaymentResponseWithIncluded included(List included) { + + this.included = included; + return this; + } + + public UnitPaymentResponseWithIncluded addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitPaymentResponseWithIncluded unitPaymentResponseWithIncluded = (UnitPaymentResponseWithIncluded) o; + return Objects.equals(this.data, unitPaymentResponseWithIncluded.data) && + Objects.equals(this.included, unitPaymentResponseWithIncluded.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitPaymentResponseWithIncluded {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitPaymentResponseWithIncluded + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitPaymentResponseWithIncluded.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitPaymentResponseWithIncluded is not found in the empty JSON string", UnitPaymentResponseWithIncluded.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitPaymentResponseWithIncluded.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitPaymentResponseWithIncluded` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Payment.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitPaymentResponseWithIncluded.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitPaymentResponseWithIncluded' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitPaymentResponseWithIncluded.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitPaymentResponseWithIncluded value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitPaymentResponseWithIncluded read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitPaymentResponseWithIncluded given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitPaymentResponseWithIncluded + * @throws IOException if the JSON string is invalid with respect to UnitPaymentResponseWithIncluded + */ + public static UnitPaymentResponseWithIncluded fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitPaymentResponseWithIncluded.class); + } + + /** + * Convert an instance of UnitPaymentResponseWithIncluded to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitPaymentsListResponse.java b/src/main/java/org/openapitools/client/model/UnitPaymentsListResponse.java new file mode 100644 index 00000000..143ae507 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitPaymentsListResponse.java @@ -0,0 +1,314 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.IncludedResourceInner; +import org.openapitools.client.model.PaginationMeta; +import org.openapitools.client.model.Payment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitPaymentsListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitPaymentsListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitPaymentsListResponse() { + } + + public UnitPaymentsListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitPaymentsListResponse addDataItem(Payment dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitPaymentsListResponse included(List included) { + + this.included = included; + return this; + } + + public UnitPaymentsListResponse addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + public UnitPaymentsListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitPaymentsListResponse unitPaymentsListResponse = (UnitPaymentsListResponse) o; + return Objects.equals(this.data, unitPaymentsListResponse.data) && + Objects.equals(this.included, unitPaymentsListResponse.included) && + Objects.equals(this.meta, unitPaymentsListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitPaymentsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitPaymentsListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitPaymentsListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitPaymentsListResponse is not found in the empty JSON string", UnitPaymentsListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitPaymentsListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitPaymentsListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Payment.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitPaymentsListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitPaymentsListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitPaymentsListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitPaymentsListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitPaymentsListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitPaymentsListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitPaymentsListResponse + * @throws IOException if the JSON string is invalid with respect to UnitPaymentsListResponse + */ + public static UnitPaymentsListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitPaymentsListResponse.class); + } + + /** + * Convert an instance of UnitPaymentsListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitReceivedPaymentListResponse.java b/src/main/java/org/openapitools/client/model/UnitReceivedPaymentListResponse.java new file mode 100644 index 00000000..50f54a54 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitReceivedPaymentListResponse.java @@ -0,0 +1,314 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.IncludedResourceInner; +import org.openapitools.client.model.PaginationMeta; +import org.openapitools.client.model.ReceivedPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitReceivedPaymentListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitReceivedPaymentListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitReceivedPaymentListResponse() { + } + + public UnitReceivedPaymentListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitReceivedPaymentListResponse addDataItem(ReceivedPayment dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitReceivedPaymentListResponse included(List included) { + + this.included = included; + return this; + } + + public UnitReceivedPaymentListResponse addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + public UnitReceivedPaymentListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitReceivedPaymentListResponse unitReceivedPaymentListResponse = (UnitReceivedPaymentListResponse) o; + return Objects.equals(this.data, unitReceivedPaymentListResponse.data) && + Objects.equals(this.included, unitReceivedPaymentListResponse.included) && + Objects.equals(this.meta, unitReceivedPaymentListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitReceivedPaymentListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitReceivedPaymentListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitReceivedPaymentListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitReceivedPaymentListResponse is not found in the empty JSON string", UnitReceivedPaymentListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitReceivedPaymentListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitReceivedPaymentListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + ReceivedPayment.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitReceivedPaymentListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitReceivedPaymentListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitReceivedPaymentListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitReceivedPaymentListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitReceivedPaymentListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitReceivedPaymentListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitReceivedPaymentListResponse + * @throws IOException if the JSON string is invalid with respect to UnitReceivedPaymentListResponse + */ + public static UnitReceivedPaymentListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitReceivedPaymentListResponse.class); + } + + /** + * Convert an instance of UnitReceivedPaymentListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitReceivedPaymentResponse.java b/src/main/java/org/openapitools/client/model/UnitReceivedPaymentResponse.java new file mode 100644 index 00000000..1701dc7c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitReceivedPaymentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.ReceivedPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitReceivedPaymentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitReceivedPaymentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPayment data; + + public UnitReceivedPaymentResponse() { + } + + public UnitReceivedPaymentResponse data(ReceivedPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ReceivedPayment getData() { + return data; + } + + + public void setData(ReceivedPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitReceivedPaymentResponse unitReceivedPaymentResponse = (UnitReceivedPaymentResponse) o; + return Objects.equals(this.data, unitReceivedPaymentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitReceivedPaymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitReceivedPaymentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitReceivedPaymentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitReceivedPaymentResponse is not found in the empty JSON string", UnitReceivedPaymentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitReceivedPaymentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitReceivedPaymentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ReceivedPayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitReceivedPaymentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitReceivedPaymentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitReceivedPaymentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitReceivedPaymentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitReceivedPaymentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitReceivedPaymentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitReceivedPaymentResponse + * @throws IOException if the JSON string is invalid with respect to UnitReceivedPaymentResponse + */ + public static UnitReceivedPaymentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitReceivedPaymentResponse.class); + } + + /** + * Convert an instance of UnitReceivedPaymentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitReceivedPaymentResponseWithIncluded.java b/src/main/java/org/openapitools/client/model/UnitReceivedPaymentResponseWithIncluded.java new file mode 100644 index 00000000..cd8fa403 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitReceivedPaymentResponseWithIncluded.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.IncludedResourceInner; +import org.openapitools.client.model.ReceivedPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitReceivedPaymentResponseWithIncluded + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitReceivedPaymentResponseWithIncluded { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private ReceivedPayment data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitReceivedPaymentResponseWithIncluded() { + } + + public UnitReceivedPaymentResponseWithIncluded data(ReceivedPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public ReceivedPayment getData() { + return data; + } + + + public void setData(ReceivedPayment data) { + this.data = data; + } + + + public UnitReceivedPaymentResponseWithIncluded included(List included) { + + this.included = included; + return this; + } + + public UnitReceivedPaymentResponseWithIncluded addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitReceivedPaymentResponseWithIncluded unitReceivedPaymentResponseWithIncluded = (UnitReceivedPaymentResponseWithIncluded) o; + return Objects.equals(this.data, unitReceivedPaymentResponseWithIncluded.data) && + Objects.equals(this.included, unitReceivedPaymentResponseWithIncluded.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitReceivedPaymentResponseWithIncluded {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitReceivedPaymentResponseWithIncluded + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitReceivedPaymentResponseWithIncluded.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitReceivedPaymentResponseWithIncluded is not found in the empty JSON string", UnitReceivedPaymentResponseWithIncluded.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitReceivedPaymentResponseWithIncluded.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitReceivedPaymentResponseWithIncluded` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + ReceivedPayment.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitReceivedPaymentResponseWithIncluded.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitReceivedPaymentResponseWithIncluded' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitReceivedPaymentResponseWithIncluded.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitReceivedPaymentResponseWithIncluded value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitReceivedPaymentResponseWithIncluded read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitReceivedPaymentResponseWithIncluded given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitReceivedPaymentResponseWithIncluded + * @throws IOException if the JSON string is invalid with respect to UnitReceivedPaymentResponseWithIncluded + */ + public static UnitReceivedPaymentResponseWithIncluded fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitReceivedPaymentResponseWithIncluded.class); + } + + /** + * Convert an instance of UnitReceivedPaymentResponseWithIncluded to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitRecurringPaymentListResponse.java b/src/main/java/org/openapitools/client/model/UnitRecurringPaymentListResponse.java new file mode 100644 index 00000000..5242085d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitRecurringPaymentListResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.PaginationMeta; +import org.openapitools.client.model.RecurringPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitRecurringPaymentListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitRecurringPaymentListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitRecurringPaymentListResponse() { + } + + public UnitRecurringPaymentListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitRecurringPaymentListResponse addDataItem(RecurringPayment dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitRecurringPaymentListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitRecurringPaymentListResponse unitRecurringPaymentListResponse = (UnitRecurringPaymentListResponse) o; + return Objects.equals(this.data, unitRecurringPaymentListResponse.data) && + Objects.equals(this.meta, unitRecurringPaymentListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitRecurringPaymentListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitRecurringPaymentListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitRecurringPaymentListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitRecurringPaymentListResponse is not found in the empty JSON string", UnitRecurringPaymentListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitRecurringPaymentListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitRecurringPaymentListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + RecurringPayment.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitRecurringPaymentListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitRecurringPaymentListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitRecurringPaymentListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitRecurringPaymentListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitRecurringPaymentListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitRecurringPaymentListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitRecurringPaymentListResponse + * @throws IOException if the JSON string is invalid with respect to UnitRecurringPaymentListResponse + */ + public static UnitRecurringPaymentListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitRecurringPaymentListResponse.class); + } + + /** + * Convert an instance of UnitRecurringPaymentListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitRecurringPaymentResponse.java b/src/main/java/org/openapitools/client/model/UnitRecurringPaymentResponse.java new file mode 100644 index 00000000..5922113f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitRecurringPaymentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.RecurringPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitRecurringPaymentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitRecurringPaymentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private RecurringPayment data; + + public UnitRecurringPaymentResponse() { + } + + public UnitRecurringPaymentResponse data(RecurringPayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public RecurringPayment getData() { + return data; + } + + + public void setData(RecurringPayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitRecurringPaymentResponse unitRecurringPaymentResponse = (UnitRecurringPaymentResponse) o; + return Objects.equals(this.data, unitRecurringPaymentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitRecurringPaymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitRecurringPaymentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitRecurringPaymentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitRecurringPaymentResponse is not found in the empty JSON string", UnitRecurringPaymentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitRecurringPaymentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitRecurringPaymentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + RecurringPayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitRecurringPaymentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitRecurringPaymentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitRecurringPaymentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitRecurringPaymentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitRecurringPaymentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitRecurringPaymentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitRecurringPaymentResponse + * @throws IOException if the JSON string is invalid with respect to UnitRecurringPaymentResponse + */ + public static UnitRecurringPaymentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitRecurringPaymentResponse.class); + } + + /** + * Convert an instance of UnitRecurringPaymentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitRepaymentResponse.java b/src/main/java/org/openapitools/client/model/UnitRepaymentResponse.java new file mode 100644 index 00000000..dee31d5e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitRepaymentResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Repayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitRepaymentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitRepaymentResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Repayment data; + + public UnitRepaymentResponse() { + } + + public UnitRepaymentResponse data(Repayment data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Repayment getData() { + return data; + } + + + public void setData(Repayment data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitRepaymentResponse unitRepaymentResponse = (UnitRepaymentResponse) o; + return Objects.equals(this.data, unitRepaymentResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitRepaymentResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitRepaymentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitRepaymentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitRepaymentResponse is not found in the empty JSON string", UnitRepaymentResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitRepaymentResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitRepaymentResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Repayment.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitRepaymentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitRepaymentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitRepaymentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitRepaymentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitRepaymentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitRepaymentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitRepaymentResponse + * @throws IOException if the JSON string is invalid with respect to UnitRepaymentResponse + */ + public static UnitRepaymentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitRepaymentResponse.class); + } + + /** + * Convert an instance of UnitRepaymentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitRepaymentsListResponse.java b/src/main/java/org/openapitools/client/model/UnitRepaymentsListResponse.java new file mode 100644 index 00000000..66a13d8e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitRepaymentsListResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.PaginationMeta; +import org.openapitools.client.model.Repayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitRepaymentsListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitRepaymentsListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitRepaymentsListResponse() { + } + + public UnitRepaymentsListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitRepaymentsListResponse addDataItem(Repayment dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitRepaymentsListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitRepaymentsListResponse unitRepaymentsListResponse = (UnitRepaymentsListResponse) o; + return Objects.equals(this.data, unitRepaymentsListResponse.data) && + Objects.equals(this.meta, unitRepaymentsListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitRepaymentsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitRepaymentsListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitRepaymentsListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitRepaymentsListResponse is not found in the empty JSON string", UnitRepaymentsListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitRepaymentsListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitRepaymentsListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Repayment.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitRepaymentsListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitRepaymentsListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitRepaymentsListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitRepaymentsListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitRepaymentsListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitRepaymentsListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitRepaymentsListResponse + * @throws IOException if the JSON string is invalid with respect to UnitRepaymentsListResponse + */ + public static UnitRepaymentsListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitRepaymentsListResponse.class); + } + + /** + * Convert an instance of UnitRepaymentsListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitRewardResponse.java b/src/main/java/org/openapitools/client/model/UnitRewardResponse.java new file mode 100644 index 00000000..50ea6cf0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitRewardResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Reward; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitRewardResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitRewardResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Reward data; + + public UnitRewardResponse() { + } + + public UnitRewardResponse data(Reward data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Reward getData() { + return data; + } + + + public void setData(Reward data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitRewardResponse unitRewardResponse = (UnitRewardResponse) o; + return Objects.equals(this.data, unitRewardResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitRewardResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitRewardResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitRewardResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitRewardResponse is not found in the empty JSON string", UnitRewardResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitRewardResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitRewardResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Reward.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitRewardResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitRewardResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitRewardResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitRewardResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitRewardResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitRewardResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitRewardResponse + * @throws IOException if the JSON string is invalid with respect to UnitRewardResponse + */ + public static UnitRewardResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitRewardResponse.class); + } + + /** + * Convert an instance of UnitRewardResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitRewardsListResponse.java b/src/main/java/org/openapitools/client/model/UnitRewardsListResponse.java new file mode 100644 index 00000000..cac849f8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitRewardsListResponse.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Reward; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitRewardsListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitRewardsListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public UnitRewardsListResponse() { + } + + public UnitRewardsListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitRewardsListResponse addDataItem(Reward dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitRewardsListResponse unitRewardsListResponse = (UnitRewardsListResponse) o; + return Objects.equals(this.data, unitRewardsListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitRewardsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitRewardsListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitRewardsListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitRewardsListResponse is not found in the empty JSON string", UnitRewardsListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitRewardsListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitRewardsListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Reward.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitRewardsListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitRewardsListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitRewardsListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitRewardsListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitRewardsListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitRewardsListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitRewardsListResponse + * @throws IOException if the JSON string is invalid with respect to UnitRewardsListResponse + */ + public static UnitRewardsListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitRewardsListResponse.class); + } + + /** + * Convert an instance of UnitRewardsListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitStatementsResponse.java b/src/main/java/org/openapitools/client/model/UnitStatementsResponse.java new file mode 100644 index 00000000..833fd439 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitStatementsResponse.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Statement; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitStatementsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitStatementsResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public UnitStatementsResponse() { + } + + public UnitStatementsResponse data(List data) { + + this.data = data; + return this; + } + + public UnitStatementsResponse addDataItem(Statement dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitStatementsResponse unitStatementsResponse = (UnitStatementsResponse) o; + return Objects.equals(this.data, unitStatementsResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitStatementsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitStatementsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitStatementsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitStatementsResponse is not found in the empty JSON string", UnitStatementsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitStatementsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitStatementsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Statement.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitStatementsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitStatementsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitStatementsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitStatementsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitStatementsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitStatementsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitStatementsResponse + * @throws IOException if the JSON string is invalid with respect to UnitStatementsResponse + */ + public static UnitStatementsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitStatementsResponse.class); + } + + /** + * Convert an instance of UnitStatementsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitTransactionResponse.java b/src/main/java/org/openapitools/client/model/UnitTransactionResponse.java new file mode 100644 index 00000000..1cb7fcc6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitTransactionResponse.java @@ -0,0 +1,263 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.IncludedResourceInner; +import org.openapitools.client.model.Transaction; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitTransactionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitTransactionResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Transaction data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public UnitTransactionResponse() { + } + + public UnitTransactionResponse data(Transaction data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Transaction getData() { + return data; + } + + + public void setData(Transaction data) { + this.data = data; + } + + + public UnitTransactionResponse included(List included) { + + this.included = included; + return this; + } + + public UnitTransactionResponse addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitTransactionResponse unitTransactionResponse = (UnitTransactionResponse) o; + return Objects.equals(this.data, unitTransactionResponse.data) && + Objects.equals(this.included, unitTransactionResponse.included); + } + + @Override + public int hashCode() { + return Objects.hash(data, included); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitTransactionResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitTransactionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitTransactionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitTransactionResponse is not found in the empty JSON string", UnitTransactionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitTransactionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitTransactionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Transaction.validateJsonElement(jsonObj.get("data")); + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitTransactionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitTransactionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitTransactionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitTransactionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitTransactionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitTransactionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitTransactionResponse + * @throws IOException if the JSON string is invalid with respect to UnitTransactionResponse + */ + public static UnitTransactionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitTransactionResponse.class); + } + + /** + * Convert an instance of UnitTransactionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitTransactionResponse1.java b/src/main/java/org/openapitools/client/model/UnitTransactionResponse1.java new file mode 100644 index 00000000..ec189cab --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitTransactionResponse1.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Transaction; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitTransactionResponse1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitTransactionResponse1 { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Transaction data; + + public UnitTransactionResponse1() { + } + + public UnitTransactionResponse1 data(Transaction data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Transaction getData() { + return data; + } + + + public void setData(Transaction data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitTransactionResponse1 unitTransactionResponse1 = (UnitTransactionResponse1) o; + return Objects.equals(this.data, unitTransactionResponse1.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitTransactionResponse1 {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitTransactionResponse1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitTransactionResponse1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitTransactionResponse1 is not found in the empty JSON string", UnitTransactionResponse1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitTransactionResponse1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitTransactionResponse1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Transaction.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitTransactionResponse1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitTransactionResponse1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitTransactionResponse1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitTransactionResponse1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitTransactionResponse1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitTransactionResponse1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitTransactionResponse1 + * @throws IOException if the JSON string is invalid with respect to UnitTransactionResponse1 + */ + public static UnitTransactionResponse1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitTransactionResponse1.class); + } + + /** + * Convert an instance of UnitTransactionResponse1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitTransactionsListResponse.java b/src/main/java/org/openapitools/client/model/UnitTransactionsListResponse.java new file mode 100644 index 00000000..08ec993c --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitTransactionsListResponse.java @@ -0,0 +1,314 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.IncludedResourceInner; +import org.openapitools.client.model.PaginationMeta; +import org.openapitools.client.model.Transaction; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitTransactionsListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitTransactionsListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_INCLUDED = "included"; + @SerializedName(SERIALIZED_NAME_INCLUDED) + private List included; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private PaginationMeta meta; + + public UnitTransactionsListResponse() { + } + + public UnitTransactionsListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitTransactionsListResponse addDataItem(Transaction dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public UnitTransactionsListResponse included(List included) { + + this.included = included; + return this; + } + + public UnitTransactionsListResponse addIncludedItem(IncludedResourceInner includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + return this; + } + + /** + * Get included + * @return included + **/ + @javax.annotation.Nullable + public List getIncluded() { + return included; + } + + + public void setIncluded(List included) { + this.included = included; + } + + + public UnitTransactionsListResponse meta(PaginationMeta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + public PaginationMeta getMeta() { + return meta; + } + + + public void setMeta(PaginationMeta meta) { + this.meta = meta; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitTransactionsListResponse unitTransactionsListResponse = (UnitTransactionsListResponse) o; + return Objects.equals(this.data, unitTransactionsListResponse.data) && + Objects.equals(this.included, unitTransactionsListResponse.included) && + Objects.equals(this.meta, unitTransactionsListResponse.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitTransactionsListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + openapiFields.add("included"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitTransactionsListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitTransactionsListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitTransactionsListResponse is not found in the empty JSON string", UnitTransactionsListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitTransactionsListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitTransactionsListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Transaction.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + if (jsonObj.get("included") != null && !jsonObj.get("included").isJsonNull()) { + JsonArray jsonArrayincluded = jsonObj.getAsJsonArray("included"); + if (jsonArrayincluded != null) { + // ensure the json data is an array + if (!jsonObj.get("included").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `included` to be an array in the JSON string but got `%s`", jsonObj.get("included").toString())); + } + + // validate the optional field `included` (array) + for (int i = 0; i < jsonArrayincluded.size(); i++) { + IncludedResourceInner.validateJsonElement(jsonArrayincluded.get(i)); + }; + } + } + // validate the optional field `meta` + if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { + PaginationMeta.validateJsonElement(jsonObj.get("meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitTransactionsListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitTransactionsListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitTransactionsListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitTransactionsListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitTransactionsListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitTransactionsListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitTransactionsListResponse + * @throws IOException if the JSON string is invalid with respect to UnitTransactionsListResponse + */ + public static UnitTransactionsListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitTransactionsListResponse.class); + } + + /** + * Convert an instance of UnitTransactionsListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitWebhookResponse.java b/src/main/java/org/openapitools/client/model/UnitWebhookResponse.java new file mode 100644 index 00000000..0e7e81ec --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitWebhookResponse.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Webhook; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitWebhookResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitWebhookResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Webhook data; + + public UnitWebhookResponse() { + } + + public UnitWebhookResponse data(Webhook data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public Webhook getData() { + return data; + } + + + public void setData(Webhook data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitWebhookResponse unitWebhookResponse = (UnitWebhookResponse) o; + return Objects.equals(this.data, unitWebhookResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitWebhookResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitWebhookResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitWebhookResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitWebhookResponse is not found in the empty JSON string", UnitWebhookResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitWebhookResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitWebhookResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + Webhook.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitWebhookResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitWebhookResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitWebhookResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitWebhookResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitWebhookResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitWebhookResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitWebhookResponse + * @throws IOException if the JSON string is invalid with respect to UnitWebhookResponse + */ + public static UnitWebhookResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitWebhookResponse.class); + } + + /** + * Convert an instance of UnitWebhookResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UnitWebhooksListResponse.java b/src/main/java/org/openapitools/client/model/UnitWebhooksListResponse.java new file mode 100644 index 00000000..c27a9d87 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UnitWebhooksListResponse.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Webhook; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UnitWebhooksListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnitWebhooksListResponse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public UnitWebhooksListResponse() { + } + + public UnitWebhooksListResponse data(List data) { + + this.data = data; + return this; + } + + public UnitWebhooksListResponse addDataItem(Webhook dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnitWebhooksListResponse unitWebhooksListResponse = (UnitWebhooksListResponse) o; + return Objects.equals(this.data, unitWebhooksListResponse.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnitWebhooksListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnitWebhooksListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnitWebhooksListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnitWebhooksListResponse is not found in the empty JSON string", UnitWebhooksListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnitWebhooksListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnitWebhooksListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Webhook.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnitWebhooksListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnitWebhooksListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnitWebhooksListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnitWebhooksListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnitWebhooksListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnitWebhooksListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnitWebhooksListResponse + * @throws IOException if the JSON string is invalid with respect to UnitWebhooksListResponse + */ + public static UnitWebhooksListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnitWebhooksListResponse.class); + } + + /** + * Convert an instance of UnitWebhooksListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateApplication.java b/src/main/java/org/openapitools/client/model/UpdateApplication.java new file mode 100644 index 00000000..17f9285b --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateApplication.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateApplicationData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateApplication { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateApplicationData data; + + public UpdateApplication() { + } + + public UpdateApplication data(UpdateApplicationData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public UpdateApplicationData getData() { + return data; + } + + + public void setData(UpdateApplicationData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateApplication updateApplication = (UpdateApplication) o; + return Objects.equals(this.data, updateApplication.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateApplication {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateApplication is not found in the empty JSON string", UpdateApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateApplicationData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateApplication + * @throws IOException if the JSON string is invalid with respect to UpdateApplication + */ + public static UpdateApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateApplication.class); + } + + /** + * Convert an instance of UpdateApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateApplicationData.java b/src/main/java/org/openapitools/client/model/UpdateApplicationData.java new file mode 100644 index 00000000..b194c642 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateApplicationData.java @@ -0,0 +1,328 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessApplication; +import org.openapitools.client.model.PatchIndividualApplication; +import org.openapitools.client.model.PatchTrustApplication; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateApplicationData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateApplicationData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateApplicationData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateApplicationData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPatchBusinessApplication = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessApplication.class)); + final TypeAdapter adapterPatchIndividualApplication = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualApplication.class)); + final TypeAdapter adapterPatchTrustApplication = gson.getDelegateAdapter(this, TypeToken.get(PatchTrustApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateApplicationData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PatchBusinessApplication` + if (value.getActualInstance() instanceof PatchBusinessApplication) { + JsonElement element = adapterPatchBusinessApplication.toJsonTree((PatchBusinessApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchIndividualApplication` + if (value.getActualInstance() instanceof PatchIndividualApplication) { + JsonElement element = adapterPatchIndividualApplication.toJsonTree((PatchIndividualApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchTrustApplication` + if (value.getActualInstance() instanceof PatchTrustApplication) { + JsonElement element = adapterPatchTrustApplication.toJsonTree((PatchTrustApplication)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PatchBusinessApplication, PatchIndividualApplication, PatchTrustApplication"); + } + + @Override + public UpdateApplicationData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PatchBusinessApplication + try { + // validate the JSON object to see if any exception is thrown + PatchBusinessApplication.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBusinessApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBusinessApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBusinessApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBusinessApplication'", e); + } + // deserialize PatchIndividualApplication + try { + // validate the JSON object to see if any exception is thrown + PatchIndividualApplication.validateJsonElement(jsonElement); + actualAdapter = adapterPatchIndividualApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchIndividualApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchIndividualApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchIndividualApplication'", e); + } + // deserialize PatchTrustApplication + try { + // validate the JSON object to see if any exception is thrown + PatchTrustApplication.validateJsonElement(jsonElement); + actualAdapter = adapterPatchTrustApplication; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchTrustApplication'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchTrustApplication failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchTrustApplication'", e); + } + + if (match == 1) { + UpdateApplicationData ret = new UpdateApplicationData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdateApplicationData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateApplicationData() { + super("oneOf", Boolean.FALSE); + } + + public UpdateApplicationData(PatchBusinessApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateApplicationData(PatchIndividualApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateApplicationData(PatchTrustApplication o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PatchBusinessApplication", PatchBusinessApplication.class); + schemas.put("PatchIndividualApplication", PatchIndividualApplication.class); + schemas.put("PatchTrustApplication", PatchTrustApplication.class); + } + + @Override + public Map> getSchemas() { + return UpdateApplicationData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PatchBusinessApplication, PatchIndividualApplication, PatchTrustApplication + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PatchBusinessApplication) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchIndividualApplication) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchTrustApplication) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PatchBusinessApplication, PatchIndividualApplication, PatchTrustApplication"); + } + + /** + * Get the actual instance, which can be the following: + * PatchBusinessApplication, PatchIndividualApplication, PatchTrustApplication + * + * @return The actual instance (PatchBusinessApplication, PatchIndividualApplication, PatchTrustApplication) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PatchBusinessApplication`. If the actual instance is not `PatchBusinessApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBusinessApplication` + * @throws ClassCastException if the instance is not `PatchBusinessApplication` + */ + public PatchBusinessApplication getPatchBusinessApplication() throws ClassCastException { + return (PatchBusinessApplication)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchIndividualApplication`. If the actual instance is not `PatchIndividualApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchIndividualApplication` + * @throws ClassCastException if the instance is not `PatchIndividualApplication` + */ + public PatchIndividualApplication getPatchIndividualApplication() throws ClassCastException { + return (PatchIndividualApplication)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchTrustApplication`. If the actual instance is not `PatchTrustApplication`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchTrustApplication` + * @throws ClassCastException if the instance is not `PatchTrustApplication` + */ + public PatchTrustApplication getPatchTrustApplication() throws ClassCastException { + return (PatchTrustApplication)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateApplicationData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PatchBusinessApplication + try { + PatchBusinessApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBusinessApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchIndividualApplication + try { + PatchIndividualApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchIndividualApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchTrustApplication + try { + PatchTrustApplication.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchTrustApplication failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdateApplicationData with oneOf schemas: PatchBusinessApplication, PatchIndividualApplication, PatchTrustApplication. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateApplicationData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateApplicationData + * @throws IOException if the JSON string is invalid with respect to UpdateApplicationData + */ + public static UpdateApplicationData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateApplicationData.class); + } + + /** + * Convert an instance of UpdateApplicationData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateBusinessCustomer.java b/src/main/java/org/openapitools/client/model/UpdateBusinessCustomer.java new file mode 100644 index 00000000..4462852d --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateBusinessCustomer.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateBusinessCustomerAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateBusinessCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateBusinessCustomer { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private UpdateBusinessCustomerAttributes attributes; + + public UpdateBusinessCustomer() { + } + + public UpdateBusinessCustomer type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UpdateBusinessCustomer attributes(UpdateBusinessCustomerAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public UpdateBusinessCustomerAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(UpdateBusinessCustomerAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateBusinessCustomer updateBusinessCustomer = (UpdateBusinessCustomer) o; + return Objects.equals(this.type, updateBusinessCustomer.type) && + Objects.equals(this.attributes, updateBusinessCustomer.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateBusinessCustomer {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateBusinessCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateBusinessCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateBusinessCustomer is not found in the empty JSON string", UpdateBusinessCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateBusinessCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateBusinessCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + UpdateBusinessCustomerAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateBusinessCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateBusinessCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateBusinessCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateBusinessCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateBusinessCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateBusinessCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateBusinessCustomer + * @throws IOException if the JSON string is invalid with respect to UpdateBusinessCustomer + */ + public static UpdateBusinessCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateBusinessCustomer.class); + } + + /** + * Convert an instance of UpdateBusinessCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateBusinessCustomerAttributes.java b/src/main/java/org/openapitools/client/model/UpdateBusinessCustomerAttributes.java new file mode 100644 index 00000000..5af9ad3f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateBusinessCustomerAttributes.java @@ -0,0 +1,431 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AuthorizedUser; +import org.openapitools.client.model.Phone; +import org.openapitools.client.model.ResponseContact; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateBusinessCustomerAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateBusinessCustomerAttributes { + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_EIN = "ein"; + @SerializedName(SERIALIZED_NAME_EIN) + private String ein; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private ResponseContact contact; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_AUTHORIZED_USERS = "authorizedUsers"; + @SerializedName(SERIALIZED_NAME_AUTHORIZED_USERS) + private List authorizedUsers; + + public UpdateBusinessCustomerAttributes() { + } + + public UpdateBusinessCustomerAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public UpdateBusinessCustomerAttributes ein(String ein) { + + this.ein = ein; + return this; + } + + /** + * Get ein + * @return ein + **/ + @javax.annotation.Nullable + public String getEin() { + return ein; + } + + + public void setEin(String ein) { + this.ein = ein; + } + + + public UpdateBusinessCustomerAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public UpdateBusinessCustomerAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public UpdateBusinessCustomerAttributes contact(ResponseContact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nullable + public ResponseContact getContact() { + return contact; + } + + + public void setContact(ResponseContact contact) { + this.contact = contact; + } + + + public UpdateBusinessCustomerAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public UpdateBusinessCustomerAttributes authorizedUsers(List authorizedUsers) { + + this.authorizedUsers = authorizedUsers; + return this; + } + + public UpdateBusinessCustomerAttributes addAuthorizedUsersItem(AuthorizedUser authorizedUsersItem) { + if (this.authorizedUsers == null) { + this.authorizedUsers = new ArrayList<>(); + } + this.authorizedUsers.add(authorizedUsersItem); + return this; + } + + /** + * Get authorizedUsers + * @return authorizedUsers + **/ + @javax.annotation.Nullable + public List getAuthorizedUsers() { + return authorizedUsers; + } + + + public void setAuthorizedUsers(List authorizedUsers) { + this.authorizedUsers = authorizedUsers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateBusinessCustomerAttributes updateBusinessCustomerAttributes = (UpdateBusinessCustomerAttributes) o; + return Objects.equals(this.dba, updateBusinessCustomerAttributes.dba) && + Objects.equals(this.ein, updateBusinessCustomerAttributes.ein) && + Objects.equals(this.phone, updateBusinessCustomerAttributes.phone) && + Objects.equals(this.address, updateBusinessCustomerAttributes.address) && + Objects.equals(this.contact, updateBusinessCustomerAttributes.contact) && + Objects.equals(this.tags, updateBusinessCustomerAttributes.tags) && + Objects.equals(this.authorizedUsers, updateBusinessCustomerAttributes.authorizedUsers); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(dba, ein, phone, address, contact, tags, authorizedUsers); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateBusinessCustomerAttributes {\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" ein: ").append(toIndentedString(ein)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" authorizedUsers: ").append(toIndentedString(authorizedUsers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dba"); + openapiFields.add("ein"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("contact"); + openapiFields.add("tags"); + openapiFields.add("authorizedUsers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateBusinessCustomerAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateBusinessCustomerAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateBusinessCustomerAttributes is not found in the empty JSON string", UpdateBusinessCustomerAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateBusinessCustomerAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateBusinessCustomerAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if ((jsonObj.get("ein") != null && !jsonObj.get("ein").isJsonNull()) && !jsonObj.get("ein").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ein` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ein").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + ResponseContact.validateJsonElement(jsonObj.get("contact")); + } + if (jsonObj.get("authorizedUsers") != null && !jsonObj.get("authorizedUsers").isJsonNull()) { + JsonArray jsonArrayauthorizedUsers = jsonObj.getAsJsonArray("authorizedUsers"); + if (jsonArrayauthorizedUsers != null) { + // ensure the json data is an array + if (!jsonObj.get("authorizedUsers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `authorizedUsers` to be an array in the JSON string but got `%s`", jsonObj.get("authorizedUsers").toString())); + } + + // validate the optional field `authorizedUsers` (array) + for (int i = 0; i < jsonArrayauthorizedUsers.size(); i++) { + AuthorizedUser.validateJsonElement(jsonArrayauthorizedUsers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateBusinessCustomerAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateBusinessCustomerAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateBusinessCustomerAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateBusinessCustomerAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateBusinessCustomerAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateBusinessCustomerAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateBusinessCustomerAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateBusinessCustomerAttributes + */ + public static UpdateBusinessCustomerAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateBusinessCustomerAttributes.class); + } + + /** + * Convert an instance of UpdateBusinessCustomerAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCard.java b/src/main/java/org/openapitools/client/model/UpdateCard.java new file mode 100644 index 00000000..93b4fec5 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCard.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateCardData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateCard + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCard { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateCardData data; + + public UpdateCard() { + } + + public UpdateCard data(UpdateCardData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public UpdateCardData getData() { + return data; + } + + + public void setData(UpdateCardData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCard updateCard = (UpdateCard) o; + return Objects.equals(this.data, updateCard.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCard {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCard + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCard.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCard is not found in the empty JSON string", UpdateCard.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateCard.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCard` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateCard.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateCardData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCard.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCard' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCard value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateCard read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCard given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCard + * @throws IOException if the JSON string is invalid with respect to UpdateCard + */ + public static UpdateCard fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCard.class); + } + + /** + * Convert an instance of UpdateCard to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCardData.java b/src/main/java/org/openapitools/client/model/UpdateCardData.java new file mode 100644 index 00000000..d8980b15 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCardData.java @@ -0,0 +1,475 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBusinessCreditCard; +import org.openapitools.client.model.PatchBusinessDebitCard; +import org.openapitools.client.model.PatchBusinessVirtualCreditCard; +import org.openapitools.client.model.PatchBusinessVirtualDebitCard; +import org.openapitools.client.model.PatchBusinessVirtualDebitCardAttributes; +import org.openapitools.client.model.PatchIndividualDebitCard; +import org.openapitools.client.model.PatchIndividualVirtualDebitCard; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCardData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateCardData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCardData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCardData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPatchIndividualDebitCard = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualDebitCard.class)); + final TypeAdapter adapterPatchIndividualVirtualDebitCard = gson.getDelegateAdapter(this, TypeToken.get(PatchIndividualVirtualDebitCard.class)); + final TypeAdapter adapterPatchBusinessDebitCard = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessDebitCard.class)); + final TypeAdapter adapterPatchBusinessVirtualDebitCard = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessVirtualDebitCard.class)); + final TypeAdapter adapterPatchBusinessCreditCard = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessCreditCard.class)); + final TypeAdapter adapterPatchBusinessVirtualCreditCard = gson.getDelegateAdapter(this, TypeToken.get(PatchBusinessVirtualCreditCard.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCardData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PatchIndividualDebitCard` + if (value.getActualInstance() instanceof PatchIndividualDebitCard) { + JsonElement element = adapterPatchIndividualDebitCard.toJsonTree((PatchIndividualDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchIndividualVirtualDebitCard` + if (value.getActualInstance() instanceof PatchIndividualVirtualDebitCard) { + JsonElement element = adapterPatchIndividualVirtualDebitCard.toJsonTree((PatchIndividualVirtualDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchBusinessDebitCard` + if (value.getActualInstance() instanceof PatchBusinessDebitCard) { + JsonElement element = adapterPatchBusinessDebitCard.toJsonTree((PatchBusinessDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchBusinessVirtualDebitCard` + if (value.getActualInstance() instanceof PatchBusinessVirtualDebitCard) { + JsonElement element = adapterPatchBusinessVirtualDebitCard.toJsonTree((PatchBusinessVirtualDebitCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchBusinessCreditCard` + if (value.getActualInstance() instanceof PatchBusinessCreditCard) { + JsonElement element = adapterPatchBusinessCreditCard.toJsonTree((PatchBusinessCreditCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchBusinessVirtualCreditCard` + if (value.getActualInstance() instanceof PatchBusinessVirtualCreditCard) { + JsonElement element = adapterPatchBusinessVirtualCreditCard.toJsonTree((PatchBusinessVirtualCreditCard)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PatchBusinessCreditCard, PatchBusinessDebitCard, PatchBusinessVirtualCreditCard, PatchBusinessVirtualDebitCard, PatchIndividualDebitCard, PatchIndividualVirtualDebitCard"); + } + + @Override + public UpdateCardData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PatchIndividualDebitCard + try { + // validate the JSON object to see if any exception is thrown + PatchIndividualDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterPatchIndividualDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchIndividualDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchIndividualDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchIndividualDebitCard'", e); + } + // deserialize PatchIndividualVirtualDebitCard + try { + // validate the JSON object to see if any exception is thrown + PatchIndividualVirtualDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterPatchIndividualVirtualDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchIndividualVirtualDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchIndividualVirtualDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchIndividualVirtualDebitCard'", e); + } + // deserialize PatchBusinessDebitCard + try { + // validate the JSON object to see if any exception is thrown + PatchBusinessDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBusinessDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBusinessDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBusinessDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBusinessDebitCard'", e); + } + // deserialize PatchBusinessVirtualDebitCard + try { + // validate the JSON object to see if any exception is thrown + PatchBusinessVirtualDebitCard.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBusinessVirtualDebitCard; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBusinessVirtualDebitCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBusinessVirtualDebitCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBusinessVirtualDebitCard'", e); + } + // deserialize PatchBusinessCreditCard + try { + // validate the JSON object to see if any exception is thrown + PatchBusinessCreditCard.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBusinessCreditCard; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBusinessCreditCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBusinessCreditCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBusinessCreditCard'", e); + } + // deserialize PatchBusinessVirtualCreditCard + try { + // validate the JSON object to see if any exception is thrown + PatchBusinessVirtualCreditCard.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBusinessVirtualCreditCard; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBusinessVirtualCreditCard'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBusinessVirtualCreditCard failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBusinessVirtualCreditCard'", e); + } + + if (match == 1) { + UpdateCardData ret = new UpdateCardData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdateCardData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateCardData() { + super("oneOf", Boolean.FALSE); + } + + public UpdateCardData(PatchBusinessCreditCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCardData(PatchBusinessDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCardData(PatchBusinessVirtualCreditCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCardData(PatchBusinessVirtualDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCardData(PatchIndividualDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCardData(PatchIndividualVirtualDebitCard o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PatchIndividualDebitCard", PatchIndividualDebitCard.class); + schemas.put("PatchIndividualVirtualDebitCard", PatchIndividualVirtualDebitCard.class); + schemas.put("PatchBusinessDebitCard", PatchBusinessDebitCard.class); + schemas.put("PatchBusinessVirtualDebitCard", PatchBusinessVirtualDebitCard.class); + schemas.put("PatchBusinessCreditCard", PatchBusinessCreditCard.class); + schemas.put("PatchBusinessVirtualCreditCard", PatchBusinessVirtualCreditCard.class); + } + + @Override + public Map> getSchemas() { + return UpdateCardData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PatchBusinessCreditCard, PatchBusinessDebitCard, PatchBusinessVirtualCreditCard, PatchBusinessVirtualDebitCard, PatchIndividualDebitCard, PatchIndividualVirtualDebitCard + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PatchIndividualDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchIndividualVirtualDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchBusinessDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchBusinessVirtualDebitCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchBusinessCreditCard) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchBusinessVirtualCreditCard) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PatchBusinessCreditCard, PatchBusinessDebitCard, PatchBusinessVirtualCreditCard, PatchBusinessVirtualDebitCard, PatchIndividualDebitCard, PatchIndividualVirtualDebitCard"); + } + + /** + * Get the actual instance, which can be the following: + * PatchBusinessCreditCard, PatchBusinessDebitCard, PatchBusinessVirtualCreditCard, PatchBusinessVirtualDebitCard, PatchIndividualDebitCard, PatchIndividualVirtualDebitCard + * + * @return The actual instance (PatchBusinessCreditCard, PatchBusinessDebitCard, PatchBusinessVirtualCreditCard, PatchBusinessVirtualDebitCard, PatchIndividualDebitCard, PatchIndividualVirtualDebitCard) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PatchIndividualDebitCard`. If the actual instance is not `PatchIndividualDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchIndividualDebitCard` + * @throws ClassCastException if the instance is not `PatchIndividualDebitCard` + */ + public PatchIndividualDebitCard getPatchIndividualDebitCard() throws ClassCastException { + return (PatchIndividualDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchIndividualVirtualDebitCard`. If the actual instance is not `PatchIndividualVirtualDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchIndividualVirtualDebitCard` + * @throws ClassCastException if the instance is not `PatchIndividualVirtualDebitCard` + */ + public PatchIndividualVirtualDebitCard getPatchIndividualVirtualDebitCard() throws ClassCastException { + return (PatchIndividualVirtualDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchBusinessDebitCard`. If the actual instance is not `PatchBusinessDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBusinessDebitCard` + * @throws ClassCastException if the instance is not `PatchBusinessDebitCard` + */ + public PatchBusinessDebitCard getPatchBusinessDebitCard() throws ClassCastException { + return (PatchBusinessDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchBusinessVirtualDebitCard`. If the actual instance is not `PatchBusinessVirtualDebitCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBusinessVirtualDebitCard` + * @throws ClassCastException if the instance is not `PatchBusinessVirtualDebitCard` + */ + public PatchBusinessVirtualDebitCard getPatchBusinessVirtualDebitCard() throws ClassCastException { + return (PatchBusinessVirtualDebitCard)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchBusinessCreditCard`. If the actual instance is not `PatchBusinessCreditCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBusinessCreditCard` + * @throws ClassCastException if the instance is not `PatchBusinessCreditCard` + */ + public PatchBusinessCreditCard getPatchBusinessCreditCard() throws ClassCastException { + return (PatchBusinessCreditCard)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchBusinessVirtualCreditCard`. If the actual instance is not `PatchBusinessVirtualCreditCard`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBusinessVirtualCreditCard` + * @throws ClassCastException if the instance is not `PatchBusinessVirtualCreditCard` + */ + public PatchBusinessVirtualCreditCard getPatchBusinessVirtualCreditCard() throws ClassCastException { + return (PatchBusinessVirtualCreditCard)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCardData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PatchIndividualDebitCard + try { + PatchIndividualDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchIndividualDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchIndividualVirtualDebitCard + try { + PatchIndividualVirtualDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchIndividualVirtualDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchBusinessDebitCard + try { + PatchBusinessDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBusinessDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchBusinessVirtualDebitCard + try { + PatchBusinessVirtualDebitCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBusinessVirtualDebitCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchBusinessCreditCard + try { + PatchBusinessCreditCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBusinessCreditCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchBusinessVirtualCreditCard + try { + PatchBusinessVirtualCreditCard.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBusinessVirtualCreditCard failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdateCardData with oneOf schemas: PatchBusinessCreditCard, PatchBusinessDebitCard, PatchBusinessVirtualCreditCard, PatchBusinessVirtualDebitCard, PatchIndividualDebitCard, PatchIndividualVirtualDebitCard. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateCardData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCardData + * @throws IOException if the JSON string is invalid with respect to UpdateCardData + */ + public static UpdateCardData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCardData.class); + } + + /** + * Convert an instance of UpdateCardData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCheckDeposit.java b/src/main/java/org/openapitools/client/model/UpdateCheckDeposit.java new file mode 100644 index 00000000..fea0e7e6 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCheckDeposit.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchCheckDeposit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateCheckDeposit + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCheckDeposit { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private PatchCheckDeposit data; + + public UpdateCheckDeposit() { + } + + public UpdateCheckDeposit data(PatchCheckDeposit data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public PatchCheckDeposit getData() { + return data; + } + + + public void setData(PatchCheckDeposit data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCheckDeposit updateCheckDeposit = (UpdateCheckDeposit) o; + return Objects.equals(this.data, updateCheckDeposit.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCheckDeposit {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCheckDeposit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCheckDeposit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCheckDeposit is not found in the empty JSON string", UpdateCheckDeposit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateCheckDeposit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCheckDeposit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateCheckDeposit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + PatchCheckDeposit.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCheckDeposit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCheckDeposit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCheckDeposit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCheckDeposit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateCheckDeposit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCheckDeposit given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCheckDeposit + * @throws IOException if the JSON string is invalid with respect to UpdateCheckDeposit + */ + public static UpdateCheckDeposit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCheckDeposit.class); + } + + /** + * Convert an instance of UpdateCheckDeposit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCounterparty.java b/src/main/java/org/openapitools/client/model/UpdateCounterparty.java new file mode 100644 index 00000000..38082e4a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCounterparty.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateCounterpartyData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCounterparty { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateCounterpartyData data; + + public UpdateCounterparty() { + } + + public UpdateCounterparty data(UpdateCounterpartyData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public UpdateCounterpartyData getData() { + return data; + } + + + public void setData(UpdateCounterpartyData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCounterparty updateCounterparty = (UpdateCounterparty) o; + return Objects.equals(this.data, updateCounterparty.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCounterparty {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCounterparty is not found in the empty JSON string", UpdateCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateCounterpartyData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCounterparty + * @throws IOException if the JSON string is invalid with respect to UpdateCounterparty + */ + public static UpdateCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCounterparty.class); + } + + /** + * Convert an instance of UpdateCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCounterpartyData.java b/src/main/java/org/openapitools/client/model/UpdateCounterpartyData.java new file mode 100644 index 00000000..74bf93c0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCounterpartyData.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchCounterparty; +import org.openapitools.client.model.PatchCounterpartyAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCounterpartyData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateCounterpartyData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCounterpartyData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCounterpartyData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPatchCounterparty = gson.getDelegateAdapter(this, TypeToken.get(PatchCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCounterpartyData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PatchCounterparty` + if (value.getActualInstance() instanceof PatchCounterparty) { + JsonElement element = adapterPatchCounterparty.toJsonTree((PatchCounterparty)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PatchCounterparty"); + } + + @Override + public UpdateCounterpartyData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PatchCounterparty + try { + // validate the JSON object to see if any exception is thrown + PatchCounterparty.validateJsonElement(jsonElement); + actualAdapter = adapterPatchCounterparty; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchCounterparty'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchCounterparty failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchCounterparty'", e); + } + + if (match == 1) { + UpdateCounterpartyData ret = new UpdateCounterpartyData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdateCounterpartyData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateCounterpartyData() { + super("oneOf", Boolean.FALSE); + } + + public UpdateCounterpartyData(PatchCounterparty o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PatchCounterparty", PatchCounterparty.class); + } + + @Override + public Map> getSchemas() { + return UpdateCounterpartyData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PatchCounterparty + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PatchCounterparty) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PatchCounterparty"); + } + + /** + * Get the actual instance, which can be the following: + * PatchCounterparty + * + * @return The actual instance (PatchCounterparty) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PatchCounterparty`. If the actual instance is not `PatchCounterparty`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchCounterparty` + * @throws ClassCastException if the instance is not `PatchCounterparty` + */ + public PatchCounterparty getPatchCounterparty() throws ClassCastException { + return (PatchCounterparty)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCounterpartyData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PatchCounterparty + try { + PatchCounterparty.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchCounterparty failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdateCounterpartyData with oneOf schemas: PatchCounterparty. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateCounterpartyData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCounterpartyData + * @throws IOException if the JSON string is invalid with respect to UpdateCounterpartyData + */ + public static UpdateCounterpartyData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCounterpartyData.class); + } + + /** + * Convert an instance of UpdateCounterpartyData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCreditAccount.java b/src/main/java/org/openapitools/client/model/UpdateCreditAccount.java new file mode 100644 index 00000000..c72fa5c8 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCreditAccount.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateCreditAccountAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateCreditAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCreditAccount { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "creditAccount"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private UpdateCreditAccountAttributes attributes; + + public UpdateCreditAccount() { + } + + public UpdateCreditAccount type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UpdateCreditAccount attributes(UpdateCreditAccountAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public UpdateCreditAccountAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(UpdateCreditAccountAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCreditAccount updateCreditAccount = (UpdateCreditAccount) o; + return Objects.equals(this.type, updateCreditAccount.type) && + Objects.equals(this.attributes, updateCreditAccount.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCreditAccount {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCreditAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCreditAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCreditAccount is not found in the empty JSON string", UpdateCreditAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateCreditAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCreditAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateCreditAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateCreditAccountAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCreditAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCreditAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCreditAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCreditAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateCreditAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCreditAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCreditAccount + * @throws IOException if the JSON string is invalid with respect to UpdateCreditAccount + */ + public static UpdateCreditAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCreditAccount.class); + } + + /** + * Convert an instance of UpdateCreditAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCreditAccountAttributes.java b/src/main/java/org/openapitools/client/model/UpdateCreditAccountAttributes.java new file mode 100644 index 00000000..0700ff61 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCreditAccountAttributes.java @@ -0,0 +1,236 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateCreditAccountAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCreditAccountAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public UpdateCreditAccountAttributes() { + } + + public UpdateCreditAccountAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public UpdateCreditAccountAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCreditAccountAttributes updateCreditAccountAttributes = (UpdateCreditAccountAttributes) o; + return Objects.equals(this.tags, updateCreditAccountAttributes.tags) && + Objects.equals(this.name, updateCreditAccountAttributes.name); + } + + @Override + public int hashCode() { + return Objects.hash(tags, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCreditAccountAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCreditAccountAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCreditAccountAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCreditAccountAttributes is not found in the empty JSON string", UpdateCreditAccountAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateCreditAccountAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCreditAccountAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCreditAccountAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCreditAccountAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCreditAccountAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCreditAccountAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateCreditAccountAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCreditAccountAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCreditAccountAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateCreditAccountAttributes + */ + public static UpdateCreditAccountAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCreditAccountAttributes.class); + } + + /** + * Convert an instance of UpdateCreditAccountAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCustomer.java b/src/main/java/org/openapitools/client/model/UpdateCustomer.java new file mode 100644 index 00000000..cc103e93 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCustomer.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateCustomerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCustomer { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateCustomerData data; + + public UpdateCustomer() { + } + + public UpdateCustomer data(UpdateCustomerData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public UpdateCustomerData getData() { + return data; + } + + + public void setData(UpdateCustomerData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCustomer updateCustomer = (UpdateCustomer) o; + return Objects.equals(this.data, updateCustomer.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCustomer {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCustomer is not found in the empty JSON string", UpdateCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + UpdateCustomerData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCustomer + * @throws IOException if the JSON string is invalid with respect to UpdateCustomer + */ + public static UpdateCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCustomer.class); + } + + /** + * Convert an instance of UpdateCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateCustomerData.java b/src/main/java/org/openapitools/client/model/UpdateCustomerData.java new file mode 100644 index 00000000..c1d6be2a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateCustomerData.java @@ -0,0 +1,328 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateBusinessCustomer; +import org.openapitools.client.model.UpdateIndividualCustomer; +import org.openapitools.client.model.UpdateTrustCustomer; +import org.openapitools.client.model.UpdateTrustCustomerAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateCustomerData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateCustomerData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCustomerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCustomerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUpdateIndividualCustomer = gson.getDelegateAdapter(this, TypeToken.get(UpdateIndividualCustomer.class)); + final TypeAdapter adapterUpdateBusinessCustomer = gson.getDelegateAdapter(this, TypeToken.get(UpdateBusinessCustomer.class)); + final TypeAdapter adapterUpdateTrustCustomer = gson.getDelegateAdapter(this, TypeToken.get(UpdateTrustCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCustomerData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UpdateIndividualCustomer` + if (value.getActualInstance() instanceof UpdateIndividualCustomer) { + JsonElement element = adapterUpdateIndividualCustomer.toJsonTree((UpdateIndividualCustomer)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateBusinessCustomer` + if (value.getActualInstance() instanceof UpdateBusinessCustomer) { + JsonElement element = adapterUpdateBusinessCustomer.toJsonTree((UpdateBusinessCustomer)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateTrustCustomer` + if (value.getActualInstance() instanceof UpdateTrustCustomer) { + JsonElement element = adapterUpdateTrustCustomer.toJsonTree((UpdateTrustCustomer)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: UpdateBusinessCustomer, UpdateIndividualCustomer, UpdateTrustCustomer"); + } + + @Override + public UpdateCustomerData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UpdateIndividualCustomer + try { + // validate the JSON object to see if any exception is thrown + UpdateIndividualCustomer.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateIndividualCustomer; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateIndividualCustomer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UpdateIndividualCustomer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateIndividualCustomer'", e); + } + // deserialize UpdateBusinessCustomer + try { + // validate the JSON object to see if any exception is thrown + UpdateBusinessCustomer.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateBusinessCustomer; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateBusinessCustomer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UpdateBusinessCustomer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateBusinessCustomer'", e); + } + // deserialize UpdateTrustCustomer + try { + // validate the JSON object to see if any exception is thrown + UpdateTrustCustomer.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateTrustCustomer; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateTrustCustomer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UpdateTrustCustomer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateTrustCustomer'", e); + } + + if (match == 1) { + UpdateCustomerData ret = new UpdateCustomerData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdateCustomerData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateCustomerData() { + super("oneOf", Boolean.FALSE); + } + + public UpdateCustomerData(UpdateBusinessCustomer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCustomerData(UpdateIndividualCustomer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateCustomerData(UpdateTrustCustomer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UpdateIndividualCustomer", UpdateIndividualCustomer.class); + schemas.put("UpdateBusinessCustomer", UpdateBusinessCustomer.class); + schemas.put("UpdateTrustCustomer", UpdateTrustCustomer.class); + } + + @Override + public Map> getSchemas() { + return UpdateCustomerData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * UpdateBusinessCustomer, UpdateIndividualCustomer, UpdateTrustCustomer + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof UpdateIndividualCustomer) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateBusinessCustomer) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateTrustCustomer) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be UpdateBusinessCustomer, UpdateIndividualCustomer, UpdateTrustCustomer"); + } + + /** + * Get the actual instance, which can be the following: + * UpdateBusinessCustomer, UpdateIndividualCustomer, UpdateTrustCustomer + * + * @return The actual instance (UpdateBusinessCustomer, UpdateIndividualCustomer, UpdateTrustCustomer) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateIndividualCustomer`. If the actual instance is not `UpdateIndividualCustomer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateIndividualCustomer` + * @throws ClassCastException if the instance is not `UpdateIndividualCustomer` + */ + public UpdateIndividualCustomer getUpdateIndividualCustomer() throws ClassCastException { + return (UpdateIndividualCustomer)super.getActualInstance(); + } + /** + * Get the actual instance of `UpdateBusinessCustomer`. If the actual instance is not `UpdateBusinessCustomer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateBusinessCustomer` + * @throws ClassCastException if the instance is not `UpdateBusinessCustomer` + */ + public UpdateBusinessCustomer getUpdateBusinessCustomer() throws ClassCastException { + return (UpdateBusinessCustomer)super.getActualInstance(); + } + /** + * Get the actual instance of `UpdateTrustCustomer`. If the actual instance is not `UpdateTrustCustomer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateTrustCustomer` + * @throws ClassCastException if the instance is not `UpdateTrustCustomer` + */ + public UpdateTrustCustomer getUpdateTrustCustomer() throws ClassCastException { + return (UpdateTrustCustomer)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCustomerData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with UpdateIndividualCustomer + try { + UpdateIndividualCustomer.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for UpdateIndividualCustomer failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateBusinessCustomer + try { + UpdateBusinessCustomer.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for UpdateBusinessCustomer failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateTrustCustomer + try { + UpdateTrustCustomer.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for UpdateTrustCustomer failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdateCustomerData with oneOf schemas: UpdateBusinessCustomer, UpdateIndividualCustomer, UpdateTrustCustomer. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateCustomerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCustomerData + * @throws IOException if the JSON string is invalid with respect to UpdateCustomerData + */ + public static UpdateCustomerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCustomerData.class); + } + + /** + * Convert an instance of UpdateCustomerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateDepositAccount.java b/src/main/java/org/openapitools/client/model/UpdateDepositAccount.java new file mode 100644 index 00000000..87bac705 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateDepositAccount.java @@ -0,0 +1,248 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateDepositAccountAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateDepositAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateDepositAccount { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "depositAccount"; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private UpdateDepositAccountAttributes attributes; + + public UpdateDepositAccount() { + } + + public UpdateDepositAccount type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UpdateDepositAccount attributes(UpdateDepositAccountAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public UpdateDepositAccountAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(UpdateDepositAccountAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateDepositAccount updateDepositAccount = (UpdateDepositAccount) o; + return Objects.equals(this.type, updateDepositAccount.type) && + Objects.equals(this.attributes, updateDepositAccount.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateDepositAccount {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateDepositAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateDepositAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateDepositAccount is not found in the empty JSON string", UpdateDepositAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateDepositAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateDepositAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateDepositAccount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `attributes` + UpdateDepositAccountAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateDepositAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateDepositAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateDepositAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateDepositAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateDepositAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateDepositAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateDepositAccount + * @throws IOException if the JSON string is invalid with respect to UpdateDepositAccount + */ + public static UpdateDepositAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateDepositAccount.class); + } + + /** + * Convert an instance of UpdateDepositAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateDepositAccountAttributes.java b/src/main/java/org/openapitools/client/model/UpdateDepositAccountAttributes.java new file mode 100644 index 00000000..1858516a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateDepositAccountAttributes.java @@ -0,0 +1,296 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateDepositAccountAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateDepositAccountAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_DEPOSIT_PRODUCT = "depositProduct"; + @SerializedName(SERIALIZED_NAME_DEPOSIT_PRODUCT) + private String depositProduct; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_OVERDRAFT_LIMIT = "overdraftLimit"; + @SerializedName(SERIALIZED_NAME_OVERDRAFT_LIMIT) + private Integer overdraftLimit; + + public UpdateDepositAccountAttributes() { + } + + public UpdateDepositAccountAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public UpdateDepositAccountAttributes depositProduct(String depositProduct) { + + this.depositProduct = depositProduct; + return this; + } + + /** + * Get depositProduct + * @return depositProduct + **/ + @javax.annotation.Nullable + public String getDepositProduct() { + return depositProduct; + } + + + public void setDepositProduct(String depositProduct) { + this.depositProduct = depositProduct; + } + + + public UpdateDepositAccountAttributes name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public UpdateDepositAccountAttributes overdraftLimit(Integer overdraftLimit) { + + this.overdraftLimit = overdraftLimit; + return this; + } + + /** + * Get overdraftLimit + * minimum: 0 + * @return overdraftLimit + **/ + @javax.annotation.Nullable + public Integer getOverdraftLimit() { + return overdraftLimit; + } + + + public void setOverdraftLimit(Integer overdraftLimit) { + this.overdraftLimit = overdraftLimit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateDepositAccountAttributes updateDepositAccountAttributes = (UpdateDepositAccountAttributes) o; + return Objects.equals(this.tags, updateDepositAccountAttributes.tags) && + Objects.equals(this.depositProduct, updateDepositAccountAttributes.depositProduct) && + Objects.equals(this.name, updateDepositAccountAttributes.name) && + Objects.equals(this.overdraftLimit, updateDepositAccountAttributes.overdraftLimit); + } + + @Override + public int hashCode() { + return Objects.hash(tags, depositProduct, name, overdraftLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateDepositAccountAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" depositProduct: ").append(toIndentedString(depositProduct)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" overdraftLimit: ").append(toIndentedString(overdraftLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + openapiFields.add("depositProduct"); + openapiFields.add("name"); + openapiFields.add("overdraftLimit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateDepositAccountAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateDepositAccountAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateDepositAccountAttributes is not found in the empty JSON string", UpdateDepositAccountAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateDepositAccountAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateDepositAccountAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("depositProduct") != null && !jsonObj.get("depositProduct").isJsonNull()) && !jsonObj.get("depositProduct").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `depositProduct` to be a primitive type in the JSON string but got `%s`", jsonObj.get("depositProduct").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateDepositAccountAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateDepositAccountAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateDepositAccountAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateDepositAccountAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateDepositAccountAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateDepositAccountAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateDepositAccountAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateDepositAccountAttributes + */ + public static UpdateDepositAccountAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateDepositAccountAttributes.class); + } + + /** + * Convert an instance of UpdateDepositAccountAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateIndividualCustomer.java b/src/main/java/org/openapitools/client/model/UpdateIndividualCustomer.java new file mode 100644 index 00000000..03792949 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateIndividualCustomer.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateIndividualCustomerAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateIndividualCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateIndividualCustomer { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private UpdateIndividualCustomerAttributes attributes; + + public UpdateIndividualCustomer() { + } + + public UpdateIndividualCustomer type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UpdateIndividualCustomer attributes(UpdateIndividualCustomerAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public UpdateIndividualCustomerAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(UpdateIndividualCustomerAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateIndividualCustomer updateIndividualCustomer = (UpdateIndividualCustomer) o; + return Objects.equals(this.type, updateIndividualCustomer.type) && + Objects.equals(this.attributes, updateIndividualCustomer.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateIndividualCustomer {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateIndividualCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateIndividualCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateIndividualCustomer is not found in the empty JSON string", UpdateIndividualCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateIndividualCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateIndividualCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + UpdateIndividualCustomerAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateIndividualCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateIndividualCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateIndividualCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateIndividualCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateIndividualCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateIndividualCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateIndividualCustomer + * @throws IOException if the JSON string is invalid with respect to UpdateIndividualCustomer + */ + public static UpdateIndividualCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateIndividualCustomer.class); + } + + /** + * Convert an instance of UpdateIndividualCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateIndividualCustomerAttributes.java b/src/main/java/org/openapitools/client/model/UpdateIndividualCustomerAttributes.java new file mode 100644 index 00000000..fb9df452 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateIndividualCustomerAttributes.java @@ -0,0 +1,429 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Address; +import org.openapitools.client.model.AuthorizedUser; +import org.openapitools.client.model.Phone; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateIndividualCustomerAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateIndividualCustomerAttributes { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + private Phone phone; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public static final String SERIALIZED_NAME_DBA = "dba"; + @SerializedName(SERIALIZED_NAME_DBA) + private String dba; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_AUTHORIZED_USERS = "authorizedUsers"; + @SerializedName(SERIALIZED_NAME_AUTHORIZED_USERS) + private List authorizedUsers; + + public static final String SERIALIZED_NAME_JWT_SUBJECT = "jwtSubject"; + @SerializedName(SERIALIZED_NAME_JWT_SUBJECT) + private String jwtSubject; + + public UpdateIndividualCustomerAttributes() { + } + + public UpdateIndividualCustomerAttributes email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public UpdateIndividualCustomerAttributes phone(Phone phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + public Phone getPhone() { + return phone; + } + + + public void setPhone(Phone phone) { + this.phone = phone; + } + + + public UpdateIndividualCustomerAttributes address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nullable + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + public UpdateIndividualCustomerAttributes dba(String dba) { + + this.dba = dba; + return this; + } + + /** + * Get dba + * @return dba + **/ + @javax.annotation.Nullable + public String getDba() { + return dba; + } + + + public void setDba(String dba) { + this.dba = dba; + } + + + public UpdateIndividualCustomerAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public UpdateIndividualCustomerAttributes authorizedUsers(List authorizedUsers) { + + this.authorizedUsers = authorizedUsers; + return this; + } + + public UpdateIndividualCustomerAttributes addAuthorizedUsersItem(AuthorizedUser authorizedUsersItem) { + if (this.authorizedUsers == null) { + this.authorizedUsers = new ArrayList<>(); + } + this.authorizedUsers.add(authorizedUsersItem); + return this; + } + + /** + * Get authorizedUsers + * @return authorizedUsers + **/ + @javax.annotation.Nullable + public List getAuthorizedUsers() { + return authorizedUsers; + } + + + public void setAuthorizedUsers(List authorizedUsers) { + this.authorizedUsers = authorizedUsers; + } + + + public UpdateIndividualCustomerAttributes jwtSubject(String jwtSubject) { + + this.jwtSubject = jwtSubject; + return this; + } + + /** + * Get jwtSubject + * @return jwtSubject + **/ + @javax.annotation.Nullable + public String getJwtSubject() { + return jwtSubject; + } + + + public void setJwtSubject(String jwtSubject) { + this.jwtSubject = jwtSubject; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateIndividualCustomerAttributes updateIndividualCustomerAttributes = (UpdateIndividualCustomerAttributes) o; + return Objects.equals(this.email, updateIndividualCustomerAttributes.email) && + Objects.equals(this.phone, updateIndividualCustomerAttributes.phone) && + Objects.equals(this.address, updateIndividualCustomerAttributes.address) && + Objects.equals(this.dba, updateIndividualCustomerAttributes.dba) && + Objects.equals(this.tags, updateIndividualCustomerAttributes.tags) && + Objects.equals(this.authorizedUsers, updateIndividualCustomerAttributes.authorizedUsers) && + Objects.equals(this.jwtSubject, updateIndividualCustomerAttributes.jwtSubject); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(email, phone, address, dba, tags, authorizedUsers, jwtSubject); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateIndividualCustomerAttributes {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dba: ").append(toIndentedString(dba)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" authorizedUsers: ").append(toIndentedString(authorizedUsers)).append("\n"); + sb.append(" jwtSubject: ").append(toIndentedString(jwtSubject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("address"); + openapiFields.add("dba"); + openapiFields.add("tags"); + openapiFields.add("authorizedUsers"); + openapiFields.add("jwtSubject"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateIndividualCustomerAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateIndividualCustomerAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateIndividualCustomerAttributes is not found in the empty JSON string", UpdateIndividualCustomerAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateIndividualCustomerAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateIndividualCustomerAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `phone` + if (jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) { + Phone.validateJsonElement(jsonObj.get("phone")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + Address.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("dba") != null && !jsonObj.get("dba").isJsonNull()) && !jsonObj.get("dba").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dba` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dba").toString())); + } + if (jsonObj.get("authorizedUsers") != null && !jsonObj.get("authorizedUsers").isJsonNull()) { + JsonArray jsonArrayauthorizedUsers = jsonObj.getAsJsonArray("authorizedUsers"); + if (jsonArrayauthorizedUsers != null) { + // ensure the json data is an array + if (!jsonObj.get("authorizedUsers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `authorizedUsers` to be an array in the JSON string but got `%s`", jsonObj.get("authorizedUsers").toString())); + } + + // validate the optional field `authorizedUsers` (array) + for (int i = 0; i < jsonArrayauthorizedUsers.size(); i++) { + AuthorizedUser.validateJsonElement(jsonArrayauthorizedUsers.get(i)); + }; + } + } + if ((jsonObj.get("jwtSubject") != null && !jsonObj.get("jwtSubject").isJsonNull()) && !jsonObj.get("jwtSubject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jwtSubject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jwtSubject").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateIndividualCustomerAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateIndividualCustomerAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateIndividualCustomerAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateIndividualCustomerAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateIndividualCustomerAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateIndividualCustomerAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateIndividualCustomerAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateIndividualCustomerAttributes + */ + public static UpdateIndividualCustomerAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateIndividualCustomerAttributes.class); + } + + /** + * Convert an instance of UpdateIndividualCustomerAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdatePayment.java b/src/main/java/org/openapitools/client/model/UpdatePayment.java new file mode 100644 index 00000000..943bd619 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdatePayment.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdatePaymentData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdatePayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdatePayment { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdatePaymentData data; + + public UpdatePayment() { + } + + public UpdatePayment data(UpdatePaymentData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public UpdatePaymentData getData() { + return data; + } + + + public void setData(UpdatePaymentData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdatePayment updatePayment = (UpdatePayment) o; + return Objects.equals(this.data, updatePayment.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePayment {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePayment is not found in the empty JSON string", UpdatePayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdatePayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdatePayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdatePayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdatePaymentData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdatePayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePayment + * @throws IOException if the JSON string is invalid with respect to UpdatePayment + */ + public static UpdatePayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePayment.class); + } + + /** + * Convert an instance of UpdatePayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdatePaymentData.java b/src/main/java/org/openapitools/client/model/UpdatePaymentData.java new file mode 100644 index 00000000..a8272326 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdatePaymentData.java @@ -0,0 +1,279 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchAchPayment; +import org.openapitools.client.model.PatchBookPayment; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdatePaymentData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdatePaymentData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePaymentData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePaymentData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPatchAchPayment = gson.getDelegateAdapter(this, TypeToken.get(PatchAchPayment.class)); + final TypeAdapter adapterPatchBookPayment = gson.getDelegateAdapter(this, TypeToken.get(PatchBookPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePaymentData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PatchAchPayment` + if (value.getActualInstance() instanceof PatchAchPayment) { + JsonElement element = adapterPatchAchPayment.toJsonTree((PatchAchPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchBookPayment` + if (value.getActualInstance() instanceof PatchBookPayment) { + JsonElement element = adapterPatchBookPayment.toJsonTree((PatchBookPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PatchAchPayment, PatchBookPayment"); + } + + @Override + public UpdatePaymentData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PatchAchPayment + try { + // validate the JSON object to see if any exception is thrown + PatchAchPayment.validateJsonElement(jsonElement); + actualAdapter = adapterPatchAchPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchAchPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchAchPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchAchPayment'", e); + } + // deserialize PatchBookPayment + try { + // validate the JSON object to see if any exception is thrown + PatchBookPayment.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBookPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBookPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBookPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBookPayment'", e); + } + + if (match == 1) { + UpdatePaymentData ret = new UpdatePaymentData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdatePaymentData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdatePaymentData() { + super("oneOf", Boolean.FALSE); + } + + public UpdatePaymentData(PatchAchPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdatePaymentData(PatchBookPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PatchAchPayment", PatchAchPayment.class); + schemas.put("PatchBookPayment", PatchBookPayment.class); + } + + @Override + public Map> getSchemas() { + return UpdatePaymentData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PatchAchPayment, PatchBookPayment + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PatchAchPayment) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchBookPayment) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PatchAchPayment, PatchBookPayment"); + } + + /** + * Get the actual instance, which can be the following: + * PatchAchPayment, PatchBookPayment + * + * @return The actual instance (PatchAchPayment, PatchBookPayment) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PatchAchPayment`. If the actual instance is not `PatchAchPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchAchPayment` + * @throws ClassCastException if the instance is not `PatchAchPayment` + */ + public PatchAchPayment getPatchAchPayment() throws ClassCastException { + return (PatchAchPayment)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchBookPayment`. If the actual instance is not `PatchBookPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBookPayment` + * @throws ClassCastException if the instance is not `PatchBookPayment` + */ + public PatchBookPayment getPatchBookPayment() throws ClassCastException { + return (PatchBookPayment)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePaymentData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PatchAchPayment + try { + PatchAchPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchAchPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchBookPayment + try { + PatchBookPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBookPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdatePaymentData with oneOf schemas: PatchAchPayment, PatchBookPayment. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdatePaymentData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePaymentData + * @throws IOException if the JSON string is invalid with respect to UpdatePaymentData + */ + public static UpdatePaymentData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePaymentData.class); + } + + /** + * Convert an instance of UpdatePaymentData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateReceivedPayment.java b/src/main/java/org/openapitools/client/model/UpdateReceivedPayment.java new file mode 100644 index 00000000..6370c447 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateReceivedPayment.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateReceivedPaymentData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateReceivedPayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateReceivedPayment { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateReceivedPaymentData data; + + public UpdateReceivedPayment() { + } + + public UpdateReceivedPayment data(UpdateReceivedPaymentData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public UpdateReceivedPaymentData getData() { + return data; + } + + + public void setData(UpdateReceivedPaymentData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReceivedPayment updateReceivedPayment = (UpdateReceivedPayment) o; + return Objects.equals(this.data, updateReceivedPayment.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateReceivedPayment {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateReceivedPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateReceivedPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateReceivedPayment is not found in the empty JSON string", UpdateReceivedPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateReceivedPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateReceivedPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateReceivedPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateReceivedPaymentData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateReceivedPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateReceivedPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateReceivedPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateReceivedPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateReceivedPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateReceivedPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateReceivedPayment + * @throws IOException if the JSON string is invalid with respect to UpdateReceivedPayment + */ + public static UpdateReceivedPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateReceivedPayment.class); + } + + /** + * Convert an instance of UpdateReceivedPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateReceivedPaymentData.java b/src/main/java/org/openapitools/client/model/UpdateReceivedPaymentData.java new file mode 100644 index 00000000..dddff555 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateReceivedPaymentData.java @@ -0,0 +1,230 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchAchReceivedPayment; +import org.openapitools.client.model.PatchTrustApplicationAttributes; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateReceivedPaymentData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateReceivedPaymentData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateReceivedPaymentData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateReceivedPaymentData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPatchAchReceivedPayment = gson.getDelegateAdapter(this, TypeToken.get(PatchAchReceivedPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateReceivedPaymentData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PatchAchReceivedPayment` + if (value.getActualInstance() instanceof PatchAchReceivedPayment) { + JsonElement element = adapterPatchAchReceivedPayment.toJsonTree((PatchAchReceivedPayment)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PatchAchReceivedPayment"); + } + + @Override + public UpdateReceivedPaymentData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PatchAchReceivedPayment + try { + // validate the JSON object to see if any exception is thrown + PatchAchReceivedPayment.validateJsonElement(jsonElement); + actualAdapter = adapterPatchAchReceivedPayment; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchAchReceivedPayment'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchAchReceivedPayment failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchAchReceivedPayment'", e); + } + + if (match == 1) { + UpdateReceivedPaymentData ret = new UpdateReceivedPaymentData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdateReceivedPaymentData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateReceivedPaymentData() { + super("oneOf", Boolean.FALSE); + } + + public UpdateReceivedPaymentData(PatchAchReceivedPayment o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PatchAchReceivedPayment", PatchAchReceivedPayment.class); + } + + @Override + public Map> getSchemas() { + return UpdateReceivedPaymentData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PatchAchReceivedPayment + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PatchAchReceivedPayment) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PatchAchReceivedPayment"); + } + + /** + * Get the actual instance, which can be the following: + * PatchAchReceivedPayment + * + * @return The actual instance (PatchAchReceivedPayment) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PatchAchReceivedPayment`. If the actual instance is not `PatchAchReceivedPayment`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchAchReceivedPayment` + * @throws ClassCastException if the instance is not `PatchAchReceivedPayment` + */ + public PatchAchReceivedPayment getPatchAchReceivedPayment() throws ClassCastException { + return (PatchAchReceivedPayment)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateReceivedPaymentData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PatchAchReceivedPayment + try { + PatchAchReceivedPayment.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchAchReceivedPayment failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdateReceivedPaymentData with oneOf schemas: PatchAchReceivedPayment. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateReceivedPaymentData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateReceivedPaymentData + * @throws IOException if the JSON string is invalid with respect to UpdateReceivedPaymentData + */ + public static UpdateReceivedPaymentData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateReceivedPaymentData.class); + } + + /** + * Convert an instance of UpdateReceivedPaymentData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateTransaction.java b/src/main/java/org/openapitools/client/model/UpdateTransaction.java new file mode 100644 index 00000000..a1779cab --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateTransaction.java @@ -0,0 +1,216 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateTransactionData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateTransaction { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateTransactionData data; + + public UpdateTransaction() { + } + + public UpdateTransaction data(UpdateTransactionData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nonnull + public UpdateTransactionData getData() { + return data; + } + + + public void setData(UpdateTransactionData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTransaction updateTransaction = (UpdateTransaction) o; + return Objects.equals(this.data, updateTransaction.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTransaction {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTransaction is not found in the empty JSON string", UpdateTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `data` + UpdateTransactionData.validateJsonElement(jsonObj.get("data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransaction + * @throws IOException if the JSON string is invalid with respect to UpdateTransaction + */ + public static UpdateTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransaction.class); + } + + /** + * Convert an instance of UpdateTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateTransactionData.java b/src/main/java/org/openapitools/client/model/UpdateTransactionData.java new file mode 100644 index 00000000..c10fbb09 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateTransactionData.java @@ -0,0 +1,329 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.PatchBookTransaction; +import org.openapitools.client.model.PatchBookTransactionAttributes; +import org.openapitools.client.model.PatchBookTransactionRelationships; +import org.openapitools.client.model.PatchChargebackTransaction; +import org.openapitools.client.model.PatchTransactionTags; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateTransactionData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateTransactionData.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTransactionData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTransactionData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPatchTransactionTags = gson.getDelegateAdapter(this, TypeToken.get(PatchTransactionTags.class)); + final TypeAdapter adapterPatchBookTransaction = gson.getDelegateAdapter(this, TypeToken.get(PatchBookTransaction.class)); + final TypeAdapter adapterPatchChargebackTransaction = gson.getDelegateAdapter(this, TypeToken.get(PatchChargebackTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTransactionData value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PatchTransactionTags` + if (value.getActualInstance() instanceof PatchTransactionTags) { + JsonElement element = adapterPatchTransactionTags.toJsonTree((PatchTransactionTags)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchBookTransaction` + if (value.getActualInstance() instanceof PatchBookTransaction) { + JsonElement element = adapterPatchBookTransaction.toJsonTree((PatchBookTransaction)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PatchChargebackTransaction` + if (value.getActualInstance() instanceof PatchChargebackTransaction) { + JsonElement element = adapterPatchChargebackTransaction.toJsonTree((PatchChargebackTransaction)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PatchBookTransaction, PatchChargebackTransaction, PatchTransactionTags"); + } + + @Override + public UpdateTransactionData read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize PatchTransactionTags + try { + // validate the JSON object to see if any exception is thrown + PatchTransactionTags.validateJsonElement(jsonElement); + actualAdapter = adapterPatchTransactionTags; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchTransactionTags'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchTransactionTags failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchTransactionTags'", e); + } + // deserialize PatchBookTransaction + try { + // validate the JSON object to see if any exception is thrown + PatchBookTransaction.validateJsonElement(jsonElement); + actualAdapter = adapterPatchBookTransaction; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchBookTransaction'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchBookTransaction failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchBookTransaction'", e); + } + // deserialize PatchChargebackTransaction + try { + // validate the JSON object to see if any exception is thrown + PatchChargebackTransaction.validateJsonElement(jsonElement); + actualAdapter = adapterPatchChargebackTransaction; + match++; + log.log(Level.FINER, "Input data matches schema 'PatchChargebackTransaction'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for PatchChargebackTransaction failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PatchChargebackTransaction'", e); + } + + if (match == 1) { + UpdateTransactionData ret = new UpdateTransactionData(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for UpdateTransactionData: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateTransactionData() { + super("oneOf", Boolean.FALSE); + } + + public UpdateTransactionData(PatchBookTransaction o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateTransactionData(PatchChargebackTransaction o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpdateTransactionData(PatchTransactionTags o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PatchTransactionTags", PatchTransactionTags.class); + schemas.put("PatchBookTransaction", PatchBookTransaction.class); + schemas.put("PatchChargebackTransaction", PatchChargebackTransaction.class); + } + + @Override + public Map> getSchemas() { + return UpdateTransactionData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PatchBookTransaction, PatchChargebackTransaction, PatchTransactionTags + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PatchTransactionTags) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchBookTransaction) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PatchChargebackTransaction) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PatchBookTransaction, PatchChargebackTransaction, PatchTransactionTags"); + } + + /** + * Get the actual instance, which can be the following: + * PatchBookTransaction, PatchChargebackTransaction, PatchTransactionTags + * + * @return The actual instance (PatchBookTransaction, PatchChargebackTransaction, PatchTransactionTags) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PatchTransactionTags`. If the actual instance is not `PatchTransactionTags`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchTransactionTags` + * @throws ClassCastException if the instance is not `PatchTransactionTags` + */ + public PatchTransactionTags getPatchTransactionTags() throws ClassCastException { + return (PatchTransactionTags)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchBookTransaction`. If the actual instance is not `PatchBookTransaction`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchBookTransaction` + * @throws ClassCastException if the instance is not `PatchBookTransaction` + */ + public PatchBookTransaction getPatchBookTransaction() throws ClassCastException { + return (PatchBookTransaction)super.getActualInstance(); + } + /** + * Get the actual instance of `PatchChargebackTransaction`. If the actual instance is not `PatchChargebackTransaction`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PatchChargebackTransaction` + * @throws ClassCastException if the instance is not `PatchChargebackTransaction` + */ + public PatchChargebackTransaction getPatchChargebackTransaction() throws ClassCastException { + return (PatchChargebackTransaction)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTransactionData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with PatchTransactionTags + try { + PatchTransactionTags.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchTransactionTags failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchBookTransaction + try { + PatchBookTransaction.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchBookTransaction failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PatchChargebackTransaction + try { + PatchChargebackTransaction.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for PatchChargebackTransaction failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for UpdateTransactionData with oneOf schemas: PatchBookTransaction, PatchChargebackTransaction, PatchTransactionTags. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateTransactionData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTransactionData + * @throws IOException if the JSON string is invalid with respect to UpdateTransactionData + */ + public static UpdateTransactionData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTransactionData.class); + } + + /** + * Convert an instance of UpdateTransactionData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateTrustCustomer.java b/src/main/java/org/openapitools/client/model/UpdateTrustCustomer.java new file mode 100644 index 00000000..8cbf7b06 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateTrustCustomer.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateTrustCustomerAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateTrustCustomer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateTrustCustomer { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private UpdateTrustCustomerAttributes attributes; + + public UpdateTrustCustomer() { + } + + public UpdateTrustCustomer type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UpdateTrustCustomer attributes(UpdateTrustCustomerAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public UpdateTrustCustomerAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(UpdateTrustCustomerAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTrustCustomer updateTrustCustomer = (UpdateTrustCustomer) o; + return Objects.equals(this.type, updateTrustCustomer.type) && + Objects.equals(this.attributes, updateTrustCustomer.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTrustCustomer {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTrustCustomer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTrustCustomer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTrustCustomer is not found in the empty JSON string", UpdateTrustCustomer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTrustCustomer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTrustCustomer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + UpdateTrustCustomerAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTrustCustomer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTrustCustomer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTrustCustomer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTrustCustomer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTrustCustomer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTrustCustomer given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTrustCustomer + * @throws IOException if the JSON string is invalid with respect to UpdateTrustCustomer + */ + public static UpdateTrustCustomer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTrustCustomer.class); + } + + /** + * Convert an instance of UpdateTrustCustomer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateTrustCustomerAttributes.java b/src/main/java/org/openapitools/client/model/UpdateTrustCustomerAttributes.java new file mode 100644 index 00000000..63ef709f --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateTrustCustomerAttributes.java @@ -0,0 +1,303 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AuthorizedUser; +import org.openapitools.client.model.TrustContact; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateTrustCustomerAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateTrustCustomerAttributes { + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + private TrustContact contact; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public static final String SERIALIZED_NAME_AUTHORIZED_USERS = "authorizedUsers"; + @SerializedName(SERIALIZED_NAME_AUTHORIZED_USERS) + private List authorizedUsers; + + public UpdateTrustCustomerAttributes() { + } + + public UpdateTrustCustomerAttributes contact(TrustContact contact) { + + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + **/ + @javax.annotation.Nullable + public TrustContact getContact() { + return contact; + } + + + public void setContact(TrustContact contact) { + this.contact = contact; + } + + + public UpdateTrustCustomerAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + public UpdateTrustCustomerAttributes authorizedUsers(List authorizedUsers) { + + this.authorizedUsers = authorizedUsers; + return this; + } + + public UpdateTrustCustomerAttributes addAuthorizedUsersItem(AuthorizedUser authorizedUsersItem) { + if (this.authorizedUsers == null) { + this.authorizedUsers = new ArrayList<>(); + } + this.authorizedUsers.add(authorizedUsersItem); + return this; + } + + /** + * Get authorizedUsers + * @return authorizedUsers + **/ + @javax.annotation.Nullable + public List getAuthorizedUsers() { + return authorizedUsers; + } + + + public void setAuthorizedUsers(List authorizedUsers) { + this.authorizedUsers = authorizedUsers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTrustCustomerAttributes updateTrustCustomerAttributes = (UpdateTrustCustomerAttributes) o; + return Objects.equals(this.contact, updateTrustCustomerAttributes.contact) && + Objects.equals(this.tags, updateTrustCustomerAttributes.tags) && + Objects.equals(this.authorizedUsers, updateTrustCustomerAttributes.authorizedUsers); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(contact, tags, authorizedUsers); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTrustCustomerAttributes {\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" authorizedUsers: ").append(toIndentedString(authorizedUsers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("contact"); + openapiFields.add("tags"); + openapiFields.add("authorizedUsers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTrustCustomerAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTrustCustomerAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTrustCustomerAttributes is not found in the empty JSON string", UpdateTrustCustomerAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTrustCustomerAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTrustCustomerAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + TrustContact.validateJsonElement(jsonObj.get("contact")); + } + if (jsonObj.get("authorizedUsers") != null && !jsonObj.get("authorizedUsers").isJsonNull()) { + JsonArray jsonArrayauthorizedUsers = jsonObj.getAsJsonArray("authorizedUsers"); + if (jsonArrayauthorizedUsers != null) { + // ensure the json data is an array + if (!jsonObj.get("authorizedUsers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `authorizedUsers` to be an array in the JSON string but got `%s`", jsonObj.get("authorizedUsers").toString())); + } + + // validate the optional field `authorizedUsers` (array) + for (int i = 0; i < jsonArrayauthorizedUsers.size(); i++) { + AuthorizedUser.validateJsonElement(jsonArrayauthorizedUsers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTrustCustomerAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTrustCustomerAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTrustCustomerAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTrustCustomerAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTrustCustomerAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTrustCustomerAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTrustCustomerAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateTrustCustomerAttributes + */ + public static UpdateTrustCustomerAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTrustCustomerAttributes.class); + } + + /** + * Convert an instance of UpdateTrustCustomerAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateUnitRequest.java b/src/main/java/org/openapitools/client/model/UpdateUnitRequest.java new file mode 100644 index 00000000..db38e192 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateUnitRequest.java @@ -0,0 +1,210 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateUnitRequestData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateUnitRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateUnitRequest { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private UpdateUnitRequestData data; + + public UpdateUnitRequest() { + } + + public UpdateUnitRequest data(UpdateUnitRequestData data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public UpdateUnitRequestData getData() { + return data; + } + + + public void setData(UpdateUnitRequestData data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUnitRequest updateUnitRequest = (UpdateUnitRequest) o; + return Objects.equals(this.data, updateUnitRequest.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUnitRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUnitRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUnitRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUnitRequest is not found in the empty JSON string", UpdateUnitRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUnitRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUnitRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + UpdateUnitRequestData.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUnitRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUnitRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnitRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUnitRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUnitRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUnitRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUnitRequest + * @throws IOException if the JSON string is invalid with respect to UpdateUnitRequest + */ + public static UpdateUnitRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUnitRequest.class); + } + + /** + * Convert an instance of UpdateUnitRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateUnitRequestData.java b/src/main/java/org/openapitools/client/model/UpdateUnitRequestData.java new file mode 100644 index 00000000..8376bfe7 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateUnitRequestData.java @@ -0,0 +1,241 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.UpdateUnitRequestDataAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateUnitRequestData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateUnitRequestData { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private UpdateUnitRequestDataAttributes attributes; + + public UpdateUnitRequestData() { + } + + public UpdateUnitRequestData type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UpdateUnitRequestData attributes(UpdateUnitRequestDataAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nullable + public UpdateUnitRequestDataAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(UpdateUnitRequestDataAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUnitRequestData updateUnitRequestData = (UpdateUnitRequestData) o; + return Objects.equals(this.type, updateUnitRequestData.type) && + Objects.equals(this.attributes, updateUnitRequestData.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUnitRequestData {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUnitRequestData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUnitRequestData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUnitRequestData is not found in the empty JSON string", UpdateUnitRequestData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUnitRequestData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUnitRequestData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + UpdateUnitRequestDataAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUnitRequestData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUnitRequestData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnitRequestData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUnitRequestData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUnitRequestData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUnitRequestData given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUnitRequestData + * @throws IOException if the JSON string is invalid with respect to UpdateUnitRequestData + */ + public static UpdateUnitRequestData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUnitRequestData.class); + } + + /** + * Convert an instance of UpdateUnitRequestData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/UpdateUnitRequestDataAttributes.java b/src/main/java/org/openapitools/client/model/UpdateUnitRequestDataAttributes.java new file mode 100644 index 00000000..cf5eeecb --- /dev/null +++ b/src/main/java/org/openapitools/client/model/UpdateUnitRequestDataAttributes.java @@ -0,0 +1,205 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * UpdateUnitRequestDataAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateUnitRequestDataAttributes { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public UpdateUnitRequestDataAttributes() { + } + + public UpdateUnitRequestDataAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUnitRequestDataAttributes updateUnitRequestDataAttributes = (UpdateUnitRequestDataAttributes) o; + return Objects.equals(this.tags, updateUnitRequestDataAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUnitRequestDataAttributes {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUnitRequestDataAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUnitRequestDataAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUnitRequestDataAttributes is not found in the empty JSON string", UpdateUnitRequestDataAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUnitRequestDataAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUnitRequestDataAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUnitRequestDataAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUnitRequestDataAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnitRequestDataAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUnitRequestDataAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUnitRequestDataAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUnitRequestDataAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUnitRequestDataAttributes + * @throws IOException if the JSON string is invalid with respect to UpdateUnitRequestDataAttributes + */ + public static UpdateUnitRequestDataAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUnitRequestDataAttributes.class); + } + + /** + * Convert an instance of UpdateUnitRequestDataAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/VirtualCardStatus.java b/src/main/java/org/openapitools/client/model/VirtualCardStatus.java new file mode 100644 index 00000000..b84f7e7e --- /dev/null +++ b/src/main/java/org/openapitools/client/model/VirtualCardStatus.java @@ -0,0 +1,84 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets virtualCardStatus + */ +@JsonAdapter(VirtualCardStatus.Adapter.class) +public enum VirtualCardStatus { + + ACTIVE("Active"), + + INACTIVE("Inactive"), + + STOLEN("Stolen"), + + LOST("Lost"), + + FROZEN("Frozen"), + + CLOSEDBYCUSTOMER("ClosedByCustomer"), + + UNKNOWN("Unknown"), + + SUSPECTEDFRAUD("SuspectedFraud"); + + private String value; + + VirtualCardStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static VirtualCardStatus fromValue(String value) { + for (VirtualCardStatus b : VirtualCardStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final VirtualCardStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public VirtualCardStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return VirtualCardStatus.fromValue(value); + } + } +} + diff --git a/src/main/java/org/openapitools/client/model/Webhook.java b/src/main/java/org/openapitools/client/model/Webhook.java new file mode 100644 index 00000000..fe121e98 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/Webhook.java @@ -0,0 +1,280 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.WebhookAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Webhook + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Webhook { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type = "webhook"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private WebhookAttributes attributes; + + public Webhook() { + } + + public Webhook type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Webhook id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Webhook attributes(WebhookAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public WebhookAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(WebhookAttributes attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Webhook webhook = (Webhook) o; + return Objects.equals(this.type, webhook.type) && + Objects.equals(this.id, webhook.id) && + Objects.equals(this.attributes, webhook.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Webhook {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("attributes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Webhook + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Webhook.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Webhook is not found in the empty JSON string", Webhook.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Webhook.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Webhook` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Webhook.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `attributes` + WebhookAttributes.validateJsonElement(jsonObj.get("attributes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Webhook.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Webhook' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Webhook.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Webhook value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Webhook read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Webhook given an JSON string + * + * @param jsonString JSON string + * @return An instance of Webhook + * @throws IOException if the JSON string is invalid with respect to Webhook + */ + public static Webhook fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Webhook.class); + } + + /** + * Convert an instance of Webhook to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WebhookAttributes.java b/src/main/java/org/openapitools/client/model/WebhookAttributes.java new file mode 100644 index 00000000..e03b8327 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WebhookAttributes.java @@ -0,0 +1,486 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WebhookAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WebhookAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_LEBEL = "lebel"; + @SerializedName(SERIALIZED_NAME_LEBEL) + private String lebel; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + JSON("Json"), + + JSONAPI("JsonAPI"); + + private String value; + + ContentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ContentTypeEnum fromValue(String value) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ContentTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CONTENT_TYPE = "contentType"; + @SerializedName(SERIALIZED_NAME_CONTENT_TYPE) + private ContentTypeEnum contentType; + + /** + * Gets or Sets deliveryMode + */ + @JsonAdapter(DeliveryModeEnum.Adapter.class) + public enum DeliveryModeEnum { + ATMOSTONCE("AtMostOnce"), + + ATLEASTONCE("AtLeastOnce"); + + private String value; + + DeliveryModeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DeliveryModeEnum fromValue(String value) { + for (DeliveryModeEnum b : DeliveryModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DeliveryModeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DeliveryModeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DeliveryModeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DELIVERY_MODE = "deliveryMode"; + @SerializedName(SERIALIZED_NAME_DELIVERY_MODE) + private DeliveryModeEnum deliveryMode; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public WebhookAttributes() { + } + + public WebhookAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WebhookAttributes lebel(String lebel) { + + this.lebel = lebel; + return this; + } + + /** + * Get lebel + * @return lebel + **/ + @javax.annotation.Nullable + public String getLebel() { + return lebel; + } + + + public void setLebel(String lebel) { + this.lebel = lebel; + } + + + public WebhookAttributes url(String url) { + + this.url = url; + return this; + } + + /** + * Get url + * @return url + **/ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + this.url = url; + } + + + public WebhookAttributes status(String status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public WebhookAttributes contentType(ContentTypeEnum contentType) { + + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + **/ + @javax.annotation.Nullable + public ContentTypeEnum getContentType() { + return contentType; + } + + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + + public WebhookAttributes deliveryMode(DeliveryModeEnum deliveryMode) { + + this.deliveryMode = deliveryMode; + return this; + } + + /** + * Get deliveryMode + * @return deliveryMode + **/ + @javax.annotation.Nullable + public DeliveryModeEnum getDeliveryMode() { + return deliveryMode; + } + + + public void setDeliveryMode(DeliveryModeEnum deliveryMode) { + this.deliveryMode = deliveryMode; + } + + + public WebhookAttributes token(String token) { + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nullable + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookAttributes webhookAttributes = (WebhookAttributes) o; + return Objects.equals(this.createdAt, webhookAttributes.createdAt) && + Objects.equals(this.lebel, webhookAttributes.lebel) && + Objects.equals(this.url, webhookAttributes.url) && + Objects.equals(this.status, webhookAttributes.status) && + Objects.equals(this.contentType, webhookAttributes.contentType) && + Objects.equals(this.deliveryMode, webhookAttributes.deliveryMode) && + Objects.equals(this.token, webhookAttributes.token); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, lebel, url, status, contentType, deliveryMode, token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" lebel: ").append(toIndentedString(lebel)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" deliveryMode: ").append(toIndentedString(deliveryMode)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("lebel"); + openapiFields.add("url"); + openapiFields.add("status"); + openapiFields.add("contentType"); + openapiFields.add("deliveryMode"); + openapiFields.add("token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookAttributes is not found in the empty JSON string", WebhookAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("lebel") != null && !jsonObj.get("lebel").isJsonNull()) && !jsonObj.get("lebel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lebel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lebel").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("contentType") != null && !jsonObj.get("contentType").isJsonNull()) && !jsonObj.get("contentType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentType").toString())); + } + if ((jsonObj.get("deliveryMode") != null && !jsonObj.get("deliveryMode").isJsonNull()) && !jsonObj.get("deliveryMode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deliveryMode").toString())); + } + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookAttributes + * @throws IOException if the JSON string is invalid with respect to WebhookAttributes + */ + public static WebhookAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookAttributes.class); + } + + /** + * Convert an instance of WebhookAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WireCounterparty.java b/src/main/java/org/openapitools/client/model/WireCounterparty.java new file mode 100644 index 00000000..6927efae --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WireCounterparty.java @@ -0,0 +1,312 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Address; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WireCounterparty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WireCounterparty { + public static final String SERIALIZED_NAME_ROUTING_NUMBER = "routingNumber"; + @SerializedName(SERIALIZED_NAME_ROUTING_NUMBER) + private String routingNumber; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + private String accountNumber; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + private Address address; + + public WireCounterparty() { + } + + public WireCounterparty routingNumber(String routingNumber) { + + this.routingNumber = routingNumber; + return this; + } + + /** + * Get routingNumber + * @return routingNumber + **/ + @javax.annotation.Nonnull + public String getRoutingNumber() { + return routingNumber; + } + + + public void setRoutingNumber(String routingNumber) { + this.routingNumber = routingNumber; + } + + + public WireCounterparty accountNumber(String accountNumber) { + + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + **/ + @javax.annotation.Nonnull + public String getAccountNumber() { + return accountNumber; + } + + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + + public WireCounterparty name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public WireCounterparty address(Address address) { + + this.address = address; + return this; + } + + /** + * Get address + * @return address + **/ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + + public void setAddress(Address address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WireCounterparty wireCounterparty = (WireCounterparty) o; + return Objects.equals(this.routingNumber, wireCounterparty.routingNumber) && + Objects.equals(this.accountNumber, wireCounterparty.accountNumber) && + Objects.equals(this.name, wireCounterparty.name) && + Objects.equals(this.address, wireCounterparty.address); + } + + @Override + public int hashCode() { + return Objects.hash(routingNumber, accountNumber, name, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WireCounterparty {\n"); + sb.append(" routingNumber: ").append(toIndentedString(routingNumber)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("routingNumber"); + openapiFields.add("accountNumber"); + openapiFields.add("name"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("routingNumber"); + openapiRequiredFields.add("accountNumber"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("address"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WireCounterparty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WireCounterparty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WireCounterparty is not found in the empty JSON string", WireCounterparty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WireCounterparty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WireCounterparty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WireCounterparty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("routingNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `routingNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("routingNumber").toString())); + } + if (!jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WireCounterparty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WireCounterparty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WireCounterparty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WireCounterparty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WireCounterparty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WireCounterparty given an JSON string + * + * @param jsonString JSON string + * @return An instance of WireCounterparty + * @throws IOException if the JSON string is invalid with respect to WireCounterparty + */ + public static WireCounterparty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WireCounterparty.class); + } + + /** + * Convert an instance of WireCounterparty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WirePayment.java b/src/main/java/org/openapitools/client/model/WirePayment.java new file mode 100644 index 00000000..ea47108a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WirePayment.java @@ -0,0 +1,251 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Payment; +import org.openapitools.client.model.PaymentRelationships; +import org.openapitools.client.model.WirePaymentAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WirePayment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WirePayment extends Payment { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private WirePaymentAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private PaymentRelationships relationships; + + public WirePayment() { + this.type = this.getClass().getSimpleName(); + } + + public WirePayment attributes(WirePaymentAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public WirePaymentAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(WirePaymentAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public WirePayment relationships(PaymentRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public PaymentRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(PaymentRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WirePayment wirePayment = (WirePayment) o; + return Objects.equals(this.attributes, wirePayment.attributes) && + Objects.equals(this.relationships, wirePayment.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WirePayment {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WirePayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WirePayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WirePayment is not found in the empty JSON string", WirePayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WirePayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WirePayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WirePayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WirePayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WirePayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WirePayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WirePayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WirePayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WirePayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of WirePayment + * @throws IOException if the JSON string is invalid with respect to WirePayment + */ + public static WirePayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WirePayment.class); + } + + /** + * Convert an instance of WirePayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WirePaymentAllOfAttributes.java b/src/main/java/org/openapitools/client/model/WirePaymentAllOfAttributes.java new file mode 100644 index 00000000..3c3303e0 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WirePaymentAllOfAttributes.java @@ -0,0 +1,566 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.WireCounterparty; +import org.openapitools.client.model.WirePaymentAllOfAttributesImadOmad; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WirePaymentAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WirePaymentAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private WireCounterparty counterparty; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("Pending"), + + REJECTED("Rejected"), + + CLEARING("Clearing"), + + SENT("Sent"), + + CANCELED("Canceled"), + + RETURNED("Returned"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_SETTLEMENT_DATE = "settlementDate"; + @SerializedName(SERIALIZED_NAME_SETTLEMENT_DATE) + private LocalDate settlementDate; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_IMAD_OMAD = "imadOmad"; + @SerializedName(SERIALIZED_NAME_IMAD_OMAD) + private WirePaymentAllOfAttributesImadOmad imadOmad; + + public WirePaymentAllOfAttributes() { + } + + public WirePaymentAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WirePaymentAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * minimum: 1 + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public WirePaymentAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public WirePaymentAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public WirePaymentAllOfAttributes counterparty(WireCounterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nullable + public WireCounterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(WireCounterparty counterparty) { + this.counterparty = counterparty; + } + + + public WirePaymentAllOfAttributes status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public WirePaymentAllOfAttributes settlementDate(LocalDate settlementDate) { + + this.settlementDate = settlementDate; + return this; + } + + /** + * Get settlementDate + * @return settlementDate + **/ + @javax.annotation.Nullable + public LocalDate getSettlementDate() { + return settlementDate; + } + + + public void setSettlementDate(LocalDate settlementDate) { + this.settlementDate = settlementDate; + } + + + public WirePaymentAllOfAttributes reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public WirePaymentAllOfAttributes imadOmad(WirePaymentAllOfAttributesImadOmad imadOmad) { + + this.imadOmad = imadOmad; + return this; + } + + /** + * Get imadOmad + * @return imadOmad + **/ + @javax.annotation.Nullable + public WirePaymentAllOfAttributesImadOmad getImadOmad() { + return imadOmad; + } + + + public void setImadOmad(WirePaymentAllOfAttributesImadOmad imadOmad) { + this.imadOmad = imadOmad; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WirePaymentAllOfAttributes wirePaymentAllOfAttributes = (WirePaymentAllOfAttributes) o; + return Objects.equals(this.createdAt, wirePaymentAllOfAttributes.createdAt) && + Objects.equals(this.amount, wirePaymentAllOfAttributes.amount) && + Objects.equals(this.direction, wirePaymentAllOfAttributes.direction) && + Objects.equals(this.description, wirePaymentAllOfAttributes.description) && + Objects.equals(this.counterparty, wirePaymentAllOfAttributes.counterparty) && + Objects.equals(this.status, wirePaymentAllOfAttributes.status) && + Objects.equals(this.settlementDate, wirePaymentAllOfAttributes.settlementDate) && + Objects.equals(this.reason, wirePaymentAllOfAttributes.reason) && + Objects.equals(this.imadOmad, wirePaymentAllOfAttributes.imadOmad); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, amount, direction, description, counterparty, status, settlementDate, reason, imadOmad); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WirePaymentAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" settlementDate: ").append(toIndentedString(settlementDate)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" imadOmad: ").append(toIndentedString(imadOmad)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("amount"); + openapiFields.add("direction"); + openapiFields.add("description"); + openapiFields.add("counterparty"); + openapiFields.add("status"); + openapiFields.add("settlementDate"); + openapiFields.add("reason"); + openapiFields.add("imadOmad"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WirePaymentAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WirePaymentAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WirePaymentAllOfAttributes is not found in the empty JSON string", WirePaymentAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WirePaymentAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WirePaymentAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WirePaymentAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `counterparty` + if (jsonObj.get("counterparty") != null && !jsonObj.get("counterparty").isJsonNull()) { + WireCounterparty.validateJsonElement(jsonObj.get("counterparty")); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + // validate the optional field `imadOmad` + if (jsonObj.get("imadOmad") != null && !jsonObj.get("imadOmad").isJsonNull()) { + WirePaymentAllOfAttributesImadOmad.validateJsonElement(jsonObj.get("imadOmad")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WirePaymentAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WirePaymentAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WirePaymentAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WirePaymentAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WirePaymentAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WirePaymentAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WirePaymentAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to WirePaymentAllOfAttributes + */ + public static WirePaymentAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WirePaymentAllOfAttributes.class); + } + + /** + * Convert an instance of WirePaymentAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WirePaymentAllOfAttributesImadOmad.java b/src/main/java/org/openapitools/client/model/WirePaymentAllOfAttributesImadOmad.java new file mode 100644 index 00000000..c9ef7269 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WirePaymentAllOfAttributesImadOmad.java @@ -0,0 +1,239 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WirePaymentAllOfAttributesImadOmad + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WirePaymentAllOfAttributesImadOmad { + public static final String SERIALIZED_NAME_IMAD = "imad"; + @SerializedName(SERIALIZED_NAME_IMAD) + private String imad; + + public static final String SERIALIZED_NAME_OMAD = "omad"; + @SerializedName(SERIALIZED_NAME_OMAD) + private String omad; + + public WirePaymentAllOfAttributesImadOmad() { + } + + public WirePaymentAllOfAttributesImadOmad imad(String imad) { + + this.imad = imad; + return this; + } + + /** + * Get imad + * @return imad + **/ + @javax.annotation.Nullable + public String getImad() { + return imad; + } + + + public void setImad(String imad) { + this.imad = imad; + } + + + public WirePaymentAllOfAttributesImadOmad omad(String omad) { + + this.omad = omad; + return this; + } + + /** + * Get omad + * @return omad + **/ + @javax.annotation.Nullable + public String getOmad() { + return omad; + } + + + public void setOmad(String omad) { + this.omad = omad; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WirePaymentAllOfAttributesImadOmad wirePaymentAllOfAttributesImadOmad = (WirePaymentAllOfAttributesImadOmad) o; + return Objects.equals(this.imad, wirePaymentAllOfAttributesImadOmad.imad) && + Objects.equals(this.omad, wirePaymentAllOfAttributesImadOmad.omad); + } + + @Override + public int hashCode() { + return Objects.hash(imad, omad); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WirePaymentAllOfAttributesImadOmad {\n"); + sb.append(" imad: ").append(toIndentedString(imad)).append("\n"); + sb.append(" omad: ").append(toIndentedString(omad)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("imad"); + openapiFields.add("omad"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WirePaymentAllOfAttributesImadOmad + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WirePaymentAllOfAttributesImadOmad.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WirePaymentAllOfAttributesImadOmad is not found in the empty JSON string", WirePaymentAllOfAttributesImadOmad.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WirePaymentAllOfAttributesImadOmad.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WirePaymentAllOfAttributesImadOmad` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("imad") != null && !jsonObj.get("imad").isJsonNull()) && !jsonObj.get("imad").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `imad` to be a primitive type in the JSON string but got `%s`", jsonObj.get("imad").toString())); + } + if ((jsonObj.get("omad") != null && !jsonObj.get("omad").isJsonNull()) && !jsonObj.get("omad").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `omad` to be a primitive type in the JSON string but got `%s`", jsonObj.get("omad").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WirePaymentAllOfAttributesImadOmad.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WirePaymentAllOfAttributesImadOmad' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WirePaymentAllOfAttributesImadOmad.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WirePaymentAllOfAttributesImadOmad value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WirePaymentAllOfAttributesImadOmad read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WirePaymentAllOfAttributesImadOmad given an JSON string + * + * @param jsonString JSON string + * @return An instance of WirePaymentAllOfAttributesImadOmad + * @throws IOException if the JSON string is invalid with respect to WirePaymentAllOfAttributesImadOmad + */ + public static WirePaymentAllOfAttributesImadOmad fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WirePaymentAllOfAttributesImadOmad.class); + } + + /** + * Convert an instance of WirePaymentAllOfAttributesImadOmad to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WireTransaction.java b/src/main/java/org/openapitools/client/model/WireTransaction.java new file mode 100644 index 00000000..80b7c114 --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WireTransaction.java @@ -0,0 +1,249 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.client.model.Transaction; +import org.openapitools.client.model.TransactionRelationships; +import org.openapitools.client.model.WireTransactionAllOfAttributes; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WireTransaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WireTransaction extends Transaction { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private WireTransactionAllOfAttributes attributes; + + public static final String SERIALIZED_NAME_RELATIONSHIPS = "relationships"; + @SerializedName(SERIALIZED_NAME_RELATIONSHIPS) + private TransactionRelationships relationships; + + public WireTransaction() { + this.type = this.getClass().getSimpleName(); + } + + public WireTransaction attributes(WireTransactionAllOfAttributes attributes) { + + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + **/ + @javax.annotation.Nonnull + public WireTransactionAllOfAttributes getAttributes() { + return attributes; + } + + + public void setAttributes(WireTransactionAllOfAttributes attributes) { + this.attributes = attributes; + } + + + public WireTransaction relationships(TransactionRelationships relationships) { + + this.relationships = relationships; + return this; + } + + /** + * Get relationships + * @return relationships + **/ + @javax.annotation.Nonnull + public TransactionRelationships getRelationships() { + return relationships; + } + + + public void setRelationships(TransactionRelationships relationships) { + this.relationships = relationships; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WireTransaction wireTransaction = (WireTransaction) o; + return Objects.equals(this.attributes, wireTransaction.attributes) && + Objects.equals(this.relationships, wireTransaction.relationships) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WireTransaction {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("attributes"); + openapiFields.add("relationships"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + openapiRequiredFields.add("relationships"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WireTransaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WireTransaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WireTransaction is not found in the empty JSON string", WireTransaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WireTransaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WireTransaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WireTransaction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WireTransaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WireTransaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WireTransaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WireTransaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WireTransaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WireTransaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of WireTransaction + * @throws IOException if the JSON string is invalid with respect to WireTransaction + */ + public static WireTransaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WireTransaction.class); + } + + /** + * Convert an instance of WireTransaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/WireTransactionAllOfAttributes.java b/src/main/java/org/openapitools/client/model/WireTransactionAllOfAttributes.java new file mode 100644 index 00000000..cb32733a --- /dev/null +++ b/src/main/java/org/openapitools/client/model/WireTransactionAllOfAttributes.java @@ -0,0 +1,662 @@ +/* + * Unit OpenAPI specifications + * An OpenAPI specifications for unit-sdk clients + * + * The version of the OpenAPI document: 0.2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.client.model.Counterparty; +import org.openapitools.client.model.WirePaymentAllOfAttributesImadOmad; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * WireTransactionAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WireTransactionAllOfAttributes { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + /** + * Gets or Sets direction + */ + @JsonAdapter(DirectionEnum.Adapter.class) + public enum DirectionEnum { + CREDIT("Credit"), + + DEBIT("Debit"); + + private String value; + + DirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DirectionEnum fromValue(String value) { + for (DirectionEnum b : DirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DirectionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private DirectionEnum direction; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Integer amount; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private Integer balance; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + private String summary; + + public static final String SERIALIZED_NAME_COUNTERPARTY = "counterparty"; + @SerializedName(SERIALIZED_NAME_COUNTERPARTY) + private Counterparty counterparty; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_SENDER_REFERENCE = "senderReference"; + @SerializedName(SERIALIZED_NAME_SENDER_REFERENCE) + private String senderReference; + + public static final String SERIALIZED_NAME_REFERENCE_FOR_BENEFICIARY = "referenceForBeneficiary"; + @SerializedName(SERIALIZED_NAME_REFERENCE_FOR_BENEFICIARY) + private String referenceForBeneficiary; + + public static final String SERIALIZED_NAME_ORIGINATOR_TO_BENEFICIARY_INFORMATION = "originatorToBeneficiaryInformation"; + @SerializedName(SERIALIZED_NAME_ORIGINATOR_TO_BENEFICIARY_INFORMATION) + private String originatorToBeneficiaryInformation; + + public static final String SERIALIZED_NAME_BENEFICIARY_INFORMATION = "beneficiaryInformation"; + @SerializedName(SERIALIZED_NAME_BENEFICIARY_INFORMATION) + private String beneficiaryInformation; + + public static final String SERIALIZED_NAME_BENEFICIARY_ADVICE_INFORMATION = "beneficiaryAdviceInformation"; + @SerializedName(SERIALIZED_NAME_BENEFICIARY_ADVICE_INFORMATION) + private String beneficiaryAdviceInformation; + + public static final String SERIALIZED_NAME_IMAD_OMAD = "imadOmad"; + @SerializedName(SERIALIZED_NAME_IMAD_OMAD) + private WirePaymentAllOfAttributesImadOmad imadOmad; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Object tags; + + public WireTransactionAllOfAttributes() { + } + + public WireTransactionAllOfAttributes createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WireTransactionAllOfAttributes direction(DirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public DirectionEnum getDirection() { + return direction; + } + + + public void setDirection(DirectionEnum direction) { + this.direction = direction; + } + + + public WireTransactionAllOfAttributes amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nonnull + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public WireTransactionAllOfAttributes balance(Integer balance) { + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nonnull + public Integer getBalance() { + return balance; + } + + + public void setBalance(Integer balance) { + this.balance = balance; + } + + + public WireTransactionAllOfAttributes summary(String summary) { + + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + **/ + @javax.annotation.Nonnull + public String getSummary() { + return summary; + } + + + public void setSummary(String summary) { + this.summary = summary; + } + + + public WireTransactionAllOfAttributes counterparty(Counterparty counterparty) { + + this.counterparty = counterparty; + return this; + } + + /** + * Get counterparty + * @return counterparty + **/ + @javax.annotation.Nonnull + public Counterparty getCounterparty() { + return counterparty; + } + + + public void setCounterparty(Counterparty counterparty) { + this.counterparty = counterparty; + } + + + public WireTransactionAllOfAttributes description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public WireTransactionAllOfAttributes senderReference(String senderReference) { + + this.senderReference = senderReference; + return this; + } + + /** + * Get senderReference + * @return senderReference + **/ + @javax.annotation.Nullable + public String getSenderReference() { + return senderReference; + } + + + public void setSenderReference(String senderReference) { + this.senderReference = senderReference; + } + + + public WireTransactionAllOfAttributes referenceForBeneficiary(String referenceForBeneficiary) { + + this.referenceForBeneficiary = referenceForBeneficiary; + return this; + } + + /** + * Get referenceForBeneficiary + * @return referenceForBeneficiary + **/ + @javax.annotation.Nullable + public String getReferenceForBeneficiary() { + return referenceForBeneficiary; + } + + + public void setReferenceForBeneficiary(String referenceForBeneficiary) { + this.referenceForBeneficiary = referenceForBeneficiary; + } + + + public WireTransactionAllOfAttributes originatorToBeneficiaryInformation(String originatorToBeneficiaryInformation) { + + this.originatorToBeneficiaryInformation = originatorToBeneficiaryInformation; + return this; + } + + /** + * Get originatorToBeneficiaryInformation + * @return originatorToBeneficiaryInformation + **/ + @javax.annotation.Nullable + public String getOriginatorToBeneficiaryInformation() { + return originatorToBeneficiaryInformation; + } + + + public void setOriginatorToBeneficiaryInformation(String originatorToBeneficiaryInformation) { + this.originatorToBeneficiaryInformation = originatorToBeneficiaryInformation; + } + + + public WireTransactionAllOfAttributes beneficiaryInformation(String beneficiaryInformation) { + + this.beneficiaryInformation = beneficiaryInformation; + return this; + } + + /** + * Get beneficiaryInformation + * @return beneficiaryInformation + **/ + @javax.annotation.Nullable + public String getBeneficiaryInformation() { + return beneficiaryInformation; + } + + + public void setBeneficiaryInformation(String beneficiaryInformation) { + this.beneficiaryInformation = beneficiaryInformation; + } + + + public WireTransactionAllOfAttributes beneficiaryAdviceInformation(String beneficiaryAdviceInformation) { + + this.beneficiaryAdviceInformation = beneficiaryAdviceInformation; + return this; + } + + /** + * Get beneficiaryAdviceInformation + * @return beneficiaryAdviceInformation + **/ + @javax.annotation.Nullable + public String getBeneficiaryAdviceInformation() { + return beneficiaryAdviceInformation; + } + + + public void setBeneficiaryAdviceInformation(String beneficiaryAdviceInformation) { + this.beneficiaryAdviceInformation = beneficiaryAdviceInformation; + } + + + public WireTransactionAllOfAttributes imadOmad(WirePaymentAllOfAttributesImadOmad imadOmad) { + + this.imadOmad = imadOmad; + return this; + } + + /** + * Get imadOmad + * @return imadOmad + **/ + @javax.annotation.Nullable + public WirePaymentAllOfAttributesImadOmad getImadOmad() { + return imadOmad; + } + + + public void setImadOmad(WirePaymentAllOfAttributesImadOmad imadOmad) { + this.imadOmad = imadOmad; + } + + + public WireTransactionAllOfAttributes tags(Object tags) { + + this.tags = tags; + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + public Object getTags() { + return tags; + } + + + public void setTags(Object tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WireTransactionAllOfAttributes wireTransactionAllOfAttributes = (WireTransactionAllOfAttributes) o; + return Objects.equals(this.createdAt, wireTransactionAllOfAttributes.createdAt) && + Objects.equals(this.direction, wireTransactionAllOfAttributes.direction) && + Objects.equals(this.amount, wireTransactionAllOfAttributes.amount) && + Objects.equals(this.balance, wireTransactionAllOfAttributes.balance) && + Objects.equals(this.summary, wireTransactionAllOfAttributes.summary) && + Objects.equals(this.counterparty, wireTransactionAllOfAttributes.counterparty) && + Objects.equals(this.description, wireTransactionAllOfAttributes.description) && + Objects.equals(this.senderReference, wireTransactionAllOfAttributes.senderReference) && + Objects.equals(this.referenceForBeneficiary, wireTransactionAllOfAttributes.referenceForBeneficiary) && + Objects.equals(this.originatorToBeneficiaryInformation, wireTransactionAllOfAttributes.originatorToBeneficiaryInformation) && + Objects.equals(this.beneficiaryInformation, wireTransactionAllOfAttributes.beneficiaryInformation) && + Objects.equals(this.beneficiaryAdviceInformation, wireTransactionAllOfAttributes.beneficiaryAdviceInformation) && + Objects.equals(this.imadOmad, wireTransactionAllOfAttributes.imadOmad) && + Objects.equals(this.tags, wireTransactionAllOfAttributes.tags); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, direction, amount, balance, summary, counterparty, description, senderReference, referenceForBeneficiary, originatorToBeneficiaryInformation, beneficiaryInformation, beneficiaryAdviceInformation, imadOmad, tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WireTransactionAllOfAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" counterparty: ").append(toIndentedString(counterparty)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" senderReference: ").append(toIndentedString(senderReference)).append("\n"); + sb.append(" referenceForBeneficiary: ").append(toIndentedString(referenceForBeneficiary)).append("\n"); + sb.append(" originatorToBeneficiaryInformation: ").append(toIndentedString(originatorToBeneficiaryInformation)).append("\n"); + sb.append(" beneficiaryInformation: ").append(toIndentedString(beneficiaryInformation)).append("\n"); + sb.append(" beneficiaryAdviceInformation: ").append(toIndentedString(beneficiaryAdviceInformation)).append("\n"); + sb.append(" imadOmad: ").append(toIndentedString(imadOmad)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("direction"); + openapiFields.add("amount"); + openapiFields.add("balance"); + openapiFields.add("summary"); + openapiFields.add("counterparty"); + openapiFields.add("description"); + openapiFields.add("senderReference"); + openapiFields.add("referenceForBeneficiary"); + openapiFields.add("originatorToBeneficiaryInformation"); + openapiFields.add("beneficiaryInformation"); + openapiFields.add("beneficiaryAdviceInformation"); + openapiFields.add("imadOmad"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("balance"); + openapiRequiredFields.add("summary"); + openapiRequiredFields.add("counterparty"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WireTransactionAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WireTransactionAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WireTransactionAllOfAttributes is not found in the empty JSON string", WireTransactionAllOfAttributes.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WireTransactionAllOfAttributes.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WireTransactionAllOfAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WireTransactionAllOfAttributes.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `direction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("direction").toString())); + } + if (!jsonObj.get("summary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `summary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("summary").toString())); + } + // validate the required field `counterparty` + Counterparty.validateJsonElement(jsonObj.get("counterparty")); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("senderReference") != null && !jsonObj.get("senderReference").isJsonNull()) && !jsonObj.get("senderReference").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `senderReference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("senderReference").toString())); + } + if ((jsonObj.get("referenceForBeneficiary") != null && !jsonObj.get("referenceForBeneficiary").isJsonNull()) && !jsonObj.get("referenceForBeneficiary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referenceForBeneficiary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referenceForBeneficiary").toString())); + } + if ((jsonObj.get("originatorToBeneficiaryInformation") != null && !jsonObj.get("originatorToBeneficiaryInformation").isJsonNull()) && !jsonObj.get("originatorToBeneficiaryInformation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `originatorToBeneficiaryInformation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("originatorToBeneficiaryInformation").toString())); + } + if ((jsonObj.get("beneficiaryInformation") != null && !jsonObj.get("beneficiaryInformation").isJsonNull()) && !jsonObj.get("beneficiaryInformation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficiaryInformation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("beneficiaryInformation").toString())); + } + if ((jsonObj.get("beneficiaryAdviceInformation") != null && !jsonObj.get("beneficiaryAdviceInformation").isJsonNull()) && !jsonObj.get("beneficiaryAdviceInformation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `beneficiaryAdviceInformation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("beneficiaryAdviceInformation").toString())); + } + // validate the optional field `imadOmad` + if (jsonObj.get("imadOmad") != null && !jsonObj.get("imadOmad").isJsonNull()) { + WirePaymentAllOfAttributesImadOmad.validateJsonElement(jsonObj.get("imadOmad")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WireTransactionAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WireTransactionAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WireTransactionAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WireTransactionAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WireTransactionAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WireTransactionAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of WireTransactionAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to WireTransactionAllOfAttributes + */ + public static WireTransactionAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WireTransactionAllOfAttributes.class); + } + + /** + * Convert an instance of WireTransactionAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/test/java/org/openapitools/client/AccountTests.java b/src/test/java/org/openapitools/client/AccountTests.java new file mode 100644 index 00000000..206db844 --- /dev/null +++ b/src/test/java/org/openapitools/client/AccountTests.java @@ -0,0 +1,112 @@ +package org.openapitools.client; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openapitools.client.api.*; +import org.openapitools.client.model.*; + +import static org.openapitools.client.CustomerTests.CreateIndividualCustomer; +import java.util.HashMap; + +public class AccountTests { + @BeforeAll + static void init() { + String access_token = System.getenv("access_token"); + ApiClient cl = new ApiClient(); + cl.setBearerToken(access_token); + Configuration.setDefaultApiClient(cl); + } + + @Test + public void GetAccountListApiTest() throws ApiException { + GetListAccountsApi api = new GetListAccountsApi(); + + UnitAccountsListResponse response = api.execute(null, null, null); + assert response.getData().size() > 0; + } + + @Test + public void GetAccountApiTest() throws ApiException { + GetListAccountsApi api = new GetListAccountsApi(); + + UnitAccountsListResponse response = api.execute(null, null, null); + assert response.getData().size() > 0; + + GetAccountApi getApi = new GetAccountApi(); + + response.getData().forEach(x -> { + try { + UnitAccountResponseWithIncluded account = getApi.execute(x.getId(), null); + assert account.getData().getId().equals(x.getId()); + assert account.getData().getType().toLowerCase() + .equals(account.getData().getClass().getSimpleName().toLowerCase()); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); + } + @Test + public void UpdateAccountApiTest() throws ApiException { + GetListAccountsApi api = new GetListAccountsApi(); + + UnitAccountsListResponse response = api.execute(null, null, null); + assert response.getData().size() > 0; + + GetAccountApi getApi = new GetAccountApi(); + + UpdateAccountApi updateAccountApi = new UpdateAccountApi(); + + response.getData().forEach(x -> { + try { + UnitAccountResponseWithIncluded account = getApi.execute(x.getId(), null); + assert account.getData().getId().equals(x.getId()); + assert account.getData().getType().toLowerCase() + .equals(account.getData().getClass().getSimpleName().toLowerCase()); + + UpdateDepositAccountAttributes attributes = new UpdateDepositAccountAttributes(); + HashMap tags = new HashMap<>(); + tags.put("test", "open-api-sdk"); + attributes.tags(tags); + + UpdateDepositAccount updateDepositAccount = new UpdateDepositAccount(); + updateDepositAccount.attributes(attributes); + PatchAccount pa = new PatchAccount().data(new PatchAccountData(updateDepositAccount)); + + UnitAccountResponse res = updateAccountApi.execute(x.getId(), pa); + res.getData().getId().equals(x.getId()); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); + } + + public static Account CreateDepositAccount() throws ApiException { + IndividualCustomer customer = CreateIndividualCustomer(); + + CreateDepositAccount cda = new CreateDepositAccount(); + CreateDepositAccountAttributes attributes = new CreateDepositAccountAttributes(); + attributes.setDepositProduct("checking"); + + CreateDepositAccountRelationships relationships = new CreateDepositAccountRelationships(); + CustomerLinkageData customerRelationshipData = new CustomerLinkageData(); + customerRelationshipData.setId(customer.getId()); + customerRelationshipData.setType(CustomerLinkageData.TypeEnum.CUSTOMER); + CustomerLinkage customerLinkageRelationship = new CustomerLinkage(); + customerLinkageRelationship.setData(customerRelationshipData); + + relationships.setCustomer(customerLinkageRelationship); + + cda.setAttributes(attributes); + cda.setRelationships(relationships); + + CreateAccountApi createAccountApi = new CreateAccountApi(); + CreateAccount ca = new CreateAccount(); + ca.setData(new CreateAccountData(cda)); + return createAccountApi.execute(ca).getData(); + } + + @Test + public void CreateDepositAccountTest() throws ApiException { + assert CreateDepositAccount().getType().equals("depositAccount"); + } +} diff --git a/src/test/java/org/openapitools/client/ApplicationTests.java b/src/test/java/org/openapitools/client/ApplicationTests.java new file mode 100644 index 00000000..b59de945 --- /dev/null +++ b/src/test/java/org/openapitools/client/ApplicationTests.java @@ -0,0 +1,187 @@ +package org.openapitools.client; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openapitools.client.api.*; +import org.openapitools.client.model.*; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import static org.openapitools.client.TestHelpers.CreateApplicationRequest; + +public class ApplicationTests { + @BeforeAll + static void init() { + String access_token = System.getenv("access_token"); + ApiClient cl = new ApiClient(); + cl.setBearerToken(access_token); + Configuration.setDefaultApiClient(cl); + } + + @Test + public void GetApplicationListApiTest() throws ApiException { + GetListApplicationsApi api = new GetListApplicationsApi(); + + ExecuteFilterParameter filter = new ExecuteFilterParameter(); + ListPageParametersObject page = new ListPageParametersObject(); + page.setLimit(20); + page.setOffset(3); + + ArrayList statuses = new ArrayList(); + statuses.add(ExecuteFilterParameter.StatusEnum.APPROVED); + statuses.add(ExecuteFilterParameter.StatusEnum.AWAITINGDOCUMENTS); + filter.setQuery("John"); + filter.setStatus(statuses); + + UnitListApplicationsResponse response = api.execute(page, filter ,null); + assert response.getData().size() <= 20; + } + + @Test + public void GetApplicationListWithFilterApiTest() throws ApiException { + GetListApplicationsApi api = new GetListApplicationsApi(); + ExecuteFilterParameter filter = new ExecuteFilterParameter(); + ListPageParametersObject page = new ListPageParametersObject(); + + ArrayList statuses = new ArrayList(); + statuses.add(ExecuteFilterParameter.StatusEnum.APPROVED); + filter.setQuery("John"); + filter.setStatus(statuses); + + UnitListApplicationsResponse response = api.execute(page, filter ,null); + assert response.getData().size() != 0; + + response.getData().forEach(x -> { + if(!x.getType().equals("individualApplication")) + return; + + IndividualApplication individualApp = (IndividualApplication)x; + String status = individualApp.getAttributes().getStatus().getValue(); + assert status.equals("Approved"); + }); + } + + @Test + public void GetApplicationApiTest() throws ApiException { + GetListApplicationsApi api = new GetListApplicationsApi(); + + UnitListApplicationsResponse response = api.execute(null, null, null); + assert response.getData().size() != 0; + + GetApplicationApi getApi = new GetApplicationApi(); + + response.getData().forEach(x -> { + try { + UnitApplicationResponseWithIncluded app = getApi.execute(x.getId(), null); + assert app.getData().getId().equals(x.getId()); + assert app.getData().getType().toLowerCase() + .equals(app.getData().getClass().getSimpleName().toLowerCase()); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); + } + + @Test + public void UpdateApplicationApiTest() throws ApiException { + GetListApplicationsApi api = new GetListApplicationsApi(); + ExecuteFilterParameter filters = new ExecuteFilterParameter(); + // filters.status(new ArrayList(){new ExecuteFilterParameter.StatusEnum[]{ExecuteFilterParameter.StatusEnum.APPROVED}}) + UnitListApplicationsResponse response = api.execute(null, null, null); + assert response.getData().size() != 0; + + UpdateApplicationApi updateApi = new UpdateApplicationApi(); + + response.getData().forEach(x -> { + try { + if(!x.getType().equals("individualApplication")) + return; + + IndividualApplication individualApp = (IndividualApplication)x; + String status = individualApp.getAttributes().getStatus().getValue(); + if(!(status.equals("Approved") || status.equals("PendingReview") || status.equals("AwaitingDocuments"))) + return; + + PatchIndividualApplication body = new PatchIndividualApplication(); + PatchIndividualApplicationAttributes attributes = new PatchIndividualApplicationAttributes(); + attributes.setOccupation(Occupation.ARCHITECTORENGINEER); + body.setAttributes(attributes); + + UpdateApplicationData d = new UpdateApplicationData(body); + UpdateApplication ua = new UpdateApplication(); + ua.data(d); + + UnitApplicationResponseWithIncluded app = updateApi.execute(x.getId(), ua); + assert app.getData().getId().equals(x.getId()); + assert app.getData().getType().toLowerCase() + .equals(app.getData().getClass().getSimpleName().toLowerCase()); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); + } + + + @Test + public void CreateApplicationApiTest() throws ApiException { + CreateApplicationApi apiClient = new CreateApplicationApi(); + UnitCreateApplicationResponse res = apiClient.execute(CreateApplicationRequest()); + assert res.getData().getType().equals("individualApplication"); + } + +// @Test +// public void CreateDocumentForApplicationApiTest() throws ApiException { +// CreateApplicationApi apiClient = new CreateApplicationApi(); +// UnitCreateApplicationResponse res = apiClient.execute(CreateApplicationRequest()); +// assert res.getData().getType().equals("individualApplication"); +// +// CreateADocumentForAnApplicationApi createApi = new CreateADocumentForAnApplicationApi(); +// UnitDocumentResponse document = createApi.execute(res.getData().getId()); +// assert document.getData().getType().equals("document"); +// } + + @Test + public void GetApplicationDocumentsApiTest() throws ApiException { + GetListApplicationsApi api = new GetListApplicationsApi(); + + UnitListApplicationsResponse response = api.execute(null, null, null); + assert response.getData().size() != 0; + } + + @Test + public void ListDocumentsApiTest() throws ApiException { + GetListOfDocumentsApi api = new GetListOfDocumentsApi(); + GetListApplicationsApi listApplicationsApi = new GetListApplicationsApi(); + + UnitListApplicationsResponse response = listApplicationsApi.execute(null, null, null); + assert response.getData().size() != 0; + + response.getData().forEach(x -> { + try { + List documents = api.execute(x.getId()).getData(); + documents.forEach(doc -> { + assert doc.getType().equals("document"); + }); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); + } + +// @Test +// public void uploadPngFile() throws ApiException, IOException { +// Path path = Paths.get("./unit_photo.png"); +// byte[] data = Files.readAllBytes(path); +// +// UploadAPngDocumentForAnApplicationApi api = new UploadAPngDocumentForAnApplicationApi(); +// UnitDocumentResponse response = api.execute("applicationId", "documentId", data); +// +// assert response.getData().getType().equals("document"); +// } +} \ No newline at end of file diff --git a/src/test/java/org/openapitools/client/CustomerTests.java b/src/test/java/org/openapitools/client/CustomerTests.java new file mode 100644 index 00000000..f54fced0 --- /dev/null +++ b/src/test/java/org/openapitools/client/CustomerTests.java @@ -0,0 +1,49 @@ +package org.openapitools.client; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openapitools.client.api.CreateApplicationApi; +import org.openapitools.client.api.GetCustomerApi; +import org.openapitools.client.api.GetListCustomersApi; +import org.openapitools.client.model.IndividualApplication; +import org.openapitools.client.model.IndividualCustomer; +import org.openapitools.client.model.UnitCreateApplicationResponse; +import org.openapitools.client.model.UnitCustomersListResponse; + +import static org.openapitools.client.TestHelpers.CreateApplicationRequest; + +public class CustomerTests { + @BeforeAll + static void init() { + String access_token = System.getenv("access_token"); + ApiClient cl = new ApiClient(); + cl.setBearerToken(access_token); + Configuration.setDefaultApiClient(cl); + } + + @Test + public void GetCustomersListApiTest() throws ApiException { + GetListCustomersApi api = new GetListCustomersApi(); + + UnitCustomersListResponse response = api.execute(null, null, null); + assert response.getData().size() > 0; + } + + public static IndividualCustomer CreateIndividualCustomer() throws ApiException { + CreateApplicationApi apiClient = new CreateApplicationApi(); + UnitCreateApplicationResponse res = apiClient.execute(CreateApplicationRequest()); + assert res.getData().getType().equals("individualApplication"); + + IndividualApplication app = (IndividualApplication) res.getData(); + String customerId = app.getRelationships().getCustomer().getData().getId(); + GetCustomerApi customerApi = new GetCustomerApi(); + + return (IndividualCustomer) customerApi.execute(customerId).getData(); + } + + @Test + public void CreateIndividualCustomerTest() throws ApiException { + IndividualCustomer customer = CreateIndividualCustomer(); + assert customer.getType().equals("individualCustomer"); + } +} diff --git a/src/test/java/org/openapitools/client/PaymentTests.java b/src/test/java/org/openapitools/client/PaymentTests.java new file mode 100644 index 00000000..12e8b3cf --- /dev/null +++ b/src/test/java/org/openapitools/client/PaymentTests.java @@ -0,0 +1,137 @@ +package org.openapitools.client; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openapitools.client.api.CreateAPaymentApi; +import org.openapitools.client.api.GetListPaymentsApi; +import org.openapitools.client.api.GetPaymentApi; +import org.openapitools.client.model.*; +import static org.openapitools.client.AccountTests.CreateDepositAccount; +import static org.openapitools.client.TestHelpers.CreateWireCounterparty; +import static org.openapitools.client.TestHelpers.CreateCounterparty; + +public class PaymentTests { + @BeforeAll + static void init() { + String access_token = System.getenv("access_token"); + ApiClient cl = new ApiClient(); + cl.setBearerToken(access_token); + Configuration.setDefaultApiClient(cl); + } + + @Test + public void GetPaymentsListApiTest() throws ApiException { + GetListPaymentsApi api = new GetListPaymentsApi(); + + UnitPaymentsListResponse response = api.execute(null, null, null, null); + assert response.getData().size() > 0; + } + + @Test + public void GetPaymentsApiTest() throws ApiException { + GetListPaymentsApi api = new GetListPaymentsApi(); + + UnitPaymentsListResponse response = api.execute(null, null, null, null); + assert response.getData().size() > 0; + + GetPaymentApi getPaymentApi = new GetPaymentApi(); + + for (Payment p: response.getData()) { + UnitPaymentResponseWithIncluded paymentResponse = getPaymentApi.execute(p.getId(), null); + assert paymentResponse.getData().getType().contains("Payment"); + } + } + + @Test + public void CreateBookPaymentTest() throws ApiException { + CreateBookPayment createBookPayment = new CreateBookPayment(); + CreateBookPaymentAttributes attributes = new CreateBookPaymentAttributes(); + attributes.setAmount(1000); + attributes.setDescription("Funding"); + createBookPayment.setAttributes(attributes); + + DepositAccount account1 = (DepositAccount) CreateDepositAccount(); + DepositAccount account2 = (DepositAccount) CreateDepositAccount(); + + CreateBookPaymentRelationships relationships = new CreateBookPaymentRelationships(); + + AccountRelationship accountRelationship = new AccountRelationship(); + AccountRelationshipData accountRelationshipData = new AccountRelationshipData(); + accountRelationshipData.setId(account1.getId()); + accountRelationshipData.setType(AccountRelationshipData.TypeEnum.DEPOSITACCOUNT); + accountRelationship.setData(accountRelationshipData); + + CounterpartyAccountRelationship counterpartyAccountRelationship = new CounterpartyAccountRelationship(); + CounterpartyAccountRelationshipData counterpartyAccountRelationshipData = new CounterpartyAccountRelationshipData(); + counterpartyAccountRelationshipData.setId(account2.getId()); + counterpartyAccountRelationshipData.setType(CounterpartyAccountRelationshipData.TypeEnum.DEPOSITACCOUNT); + counterpartyAccountRelationship.setData(counterpartyAccountRelationshipData); + + relationships.setAccount(accountRelationship); + relationships.setCounterpartyAccount(counterpartyAccountRelationship); + createBookPayment.setRelationships(relationships); + + CreateAPaymentApi createApi = new CreateAPaymentApi(); + ExecuteRequest6 request = new ExecuteRequest6(); + request.setData(new CreatePayment(createBookPayment)); + UnitPaymentResponse response = createApi.execute(request); + assert response.getData().getType().equals("bookPayment"); + } + + @Test + public void CreateAchPaymentTest() throws ApiException { + CreateAchPayment createAchPayment = new CreateAchPayment(); + CreateAchPaymentAttributes attributes = new CreateAchPaymentAttributes(); + attributes.setAmount(1000); + attributes.setCounterparty(CreateCounterparty()); + attributes.setDirection(CreateAchPaymentAttributes.DirectionEnum.CREDIT); + attributes.setDescription("Funding"); + createAchPayment.setAttributes(attributes); + + DepositAccount account = (DepositAccount) CreateDepositAccount(); + + CreateAchPaymentRelationships relationships = new CreateAchPaymentRelationships(); + AccountRelationship accountRelationship = new AccountRelationship(); + AccountRelationshipData accountRelationshipData = new AccountRelationshipData(); + accountRelationshipData.setId(account.getId()); + accountRelationshipData.setType(AccountRelationshipData.TypeEnum.ACCOUNT); + accountRelationship.setData(accountRelationshipData); + relationships.setAccount(accountRelationship); + createAchPayment.setRelationships(relationships); + + CreateAPaymentApi createApi = new CreateAPaymentApi(); + ExecuteRequest6 request = new ExecuteRequest6(); + request.setData(new CreatePayment(createAchPayment)); + UnitPaymentResponse response = createApi.execute(request); + assert response.getData().getType().equals("achPayment"); + } + + @Test + public void CreateWirePaymentTest() throws ApiException { + CreateWirePayment createWirePayment = new CreateWirePayment(); + CreateWirePaymentAttributes attributes = new CreateWirePaymentAttributes(); + createWirePayment.setType("wirePayment"); + attributes.setAmount(100); + attributes.setDirection(CreateWirePaymentAttributes.DirectionEnum.CREDIT); + attributes.setCounterparty(CreateWireCounterparty()); + attributes.setDescription("Wire payment"); + createWirePayment.setAttributes(attributes); + + DepositAccount account = (DepositAccount) CreateDepositAccount(); + + CreateAchPaymentRelationships relationships = new CreateAchPaymentRelationships(); + AccountRelationship accountRelationship = new AccountRelationship(); + AccountRelationshipData accountRelationshipData = new AccountRelationshipData(); + accountRelationshipData.setId(account.getId()); + accountRelationshipData.setType(AccountRelationshipData.TypeEnum.ACCOUNT); + accountRelationship.setData(accountRelationshipData); + relationships.setAccount(accountRelationship); + createWirePayment.setRelationships(relationships); + + CreateAPaymentApi createApi = new CreateAPaymentApi(); + ExecuteRequest6 request = new ExecuteRequest6(); + request.setData(new CreatePayment(createWirePayment)); + UnitPaymentResponse response = createApi.execute(request); + assert response.getData().getType().equals("wirePayment"); + } +} diff --git a/src/test/java/org/openapitools/client/ReceivedPaymentTests.java b/src/test/java/org/openapitools/client/ReceivedPaymentTests.java new file mode 100644 index 00000000..1b971567 --- /dev/null +++ b/src/test/java/org/openapitools/client/ReceivedPaymentTests.java @@ -0,0 +1,55 @@ +package org.openapitools.client;//package org.openapitools.client; +// +//import org.junit.jupiter.api.BeforeAll; +//import org.junit.jupiter.api.Test; +//import org.openapitools.client.api.GetReceivedPaymentApi; +//import org.openapitools.client.api.GetReceivedPaymentsListApi; +//import org.openapitools.client.model.UnitReceivedPaymentListResponse; +//import org.openapitools.client.model.UnitReceivedPaymentResponseWithIncluded; +// +//public class ReceivedPaymentTests { +// @BeforeAll +// static void init() { +// String access_token = System.getenv("access_token"); +// ApiClient cl = new ApiClient(); +// cl.setBearerToken(access_token); +// Configuration.setDefaultApiClient(cl); +// } +// +// @Test +// public void GetReceivedPaymentListApiTest() throws ApiException { +// GetReceivedPaymentsListApi api = new GetReceivedPaymentsListApi(); +// +// UnitReceivedPaymentListResponse response = api.execute(null); +// assert response.getData().size() != 0; +// } +// +// @Test +// public void GetReceivedPaymentListWithIncludedApiTest() throws ApiException { +// GetReceivedPaymentsListApi api = new GetReceivedPaymentsListApi(); +// +// UnitReceivedPaymentListResponse response = api.execute(null); +// assert response.getData().size() != 0; +// } +// +// @Test +// public void GetReceivedPaymentApiTest() throws ApiException { +// GetReceivedPaymentsListApi api = new GetReceivedPaymentsListApi(); +// +// UnitReceivedPaymentListResponse response = api.execute(null); +// assert response.getData().size() != 0; +// +// GetReceivedPaymentApi getApi = new GetReceivedPaymentApi(); +// +// response.getData().forEach(x -> { +// try { +// UnitReceivedPaymentResponseWithIncluded payment = getApi.execute(x.getId(), null); +// assert payment.getData().getId().equals(x.getId()); +// assert payment.getData().getAttributes().getAmount().equals(x.getAttributes().getAmount()); +// } catch (ApiException e) { +// throw new RuntimeException(e); +// } +// }); +// } +// +//} diff --git a/src/test/java/org/openapitools/client/RecurringPaymentTests.java b/src/test/java/org/openapitools/client/RecurringPaymentTests.java new file mode 100644 index 00000000..3cea1aad --- /dev/null +++ b/src/test/java/org/openapitools/client/RecurringPaymentTests.java @@ -0,0 +1,49 @@ +package org.openapitools.client;//package org.openapitools.client; +// +//import org.junit.jupiter.api.BeforeAll; +//import org.junit.jupiter.api.Test; +//import org.openapitools.client.api.GetListRecurringPaymentsApi; +//import org.openapitools.client.api.GetRecurringPaymentApi; +//import org.openapitools.client.model.UnitRecurringPaymentListResponse; +//import org.openapitools.client.model.UnitRecurringPaymentResponse; +// +// +//public class RecurringPaymentTests { +// @BeforeAll +// static void init() { +// String access_token = System.getenv("access_token"); +// ApiClient cl = new ApiClient(); +// cl.setBearerToken(access_token); +// Configuration.setDefaultApiClient(cl); +// } +// +// @Test +// public void GetRecurringPaymentListApiTest() throws ApiException { +// GetListRecurringPaymentsApi api = new GetListRecurringPaymentsApi(); +// +// UnitRecurringPaymentListResponse response = api.execute(); +// assert response.getData().size() != 0; +// } +// +// @Test +// public void GetRecurringPaymentApiTest() throws ApiException { +// GetListRecurringPaymentsApi api = new GetListRecurringPaymentsApi(); +// +// UnitRecurringPaymentListResponse response = api.execute(); +// assert response.getData().size() != 0; +// +// GetRecurringPaymentApi getApi = new GetRecurringPaymentApi(); +// +// response.getData().forEach(x -> { +// try { +// UnitRecurringPaymentResponse payment = getApi.execute(x.getId()); +// assert payment.getData().getId().equals(x.getId()); +// assert payment.getData().getType().toLowerCase() +// .equals(payment.getData().getClass().getSimpleName().toLowerCase()); +// } catch (ApiException e) { +// throw new RuntimeException(e); +// } +// }); +// } +// +//} diff --git a/src/test/java/org/openapitools/client/TestHelpers.java b/src/test/java/org/openapitools/client/TestHelpers.java new file mode 100644 index 00000000..167e2318 --- /dev/null +++ b/src/test/java/org/openapitools/client/TestHelpers.java @@ -0,0 +1,73 @@ +package org.openapitools.client; + +import org.openapitools.client.model.*; + +import java.time.LocalDate; + +public class TestHelpers { + public static CreateApplication CreateApplicationRequest() { + CreateIndividualApplication createIndividualApplication = new CreateIndividualApplication(); + CreateIndividualApplicationAttributes attr = new CreateIndividualApplicationAttributes(); + + FullName fn = new FullName(); + fn.setFirst("Peter"); + fn.setLast("Parker"); + attr.setFullName(fn); + + Address address = new Address(); + address.setStreet("20 Ingram St"); + address.setCity("Forest Hills"); + address.setPostalCode("11375"); + address.setCountry("US"); + address.setState("NY"); + attr.setAddress(address); + + attr.setSsn("721074426"); + attr.setDateOfBirth(LocalDate.parse("2001-08-10")); + attr.setEmail("peter@oscorp.com"); + Phone p = new Phone(); + p.setNumber("5555555555"); + p.setCountryCode("1"); + attr.setPhone(p); + attr.setIdempotencyKey("3a1a33be-4e12-4603-9ed0-820922389fb8"); + attr.setOccupation(Occupation.ARCHITECTORENGINEER); + + createIndividualApplication.setAttributes(attr); + + CreateApplication ca = new CreateApplication(); + ca.data(new CreateApplicationData(createIndividualApplication)); + + return ca; + } + + public static Counterparty CreateCounterparty() { + Counterparty counterparty = new Counterparty(); + counterparty.setName("Jane Doe"); + counterparty.setRoutingNumber("812345673"); + counterparty.setAccountNumber("12345569"); + counterparty.setAccountType(Counterparty.AccountTypeEnum.CHECKING); + + return counterparty; + } + + public static Address CreateAddress() { + Address address = new Address(); + address.setStreet("20 Ingram St"); + address.setCity("Forest Hills"); + address.setState("CA"); + address.setPostalCode("11375"); + address.setCountry("US"); + + return address; + } + + public static WireCounterparty CreateWireCounterparty() { + WireCounterparty counterparty = new WireCounterparty(); + counterparty.setName("April Oniel"); + counterparty.setAccountNumber("1000000001"); + counterparty.setRoutingNumber("812345678"); + counterparty.setAddress(CreateAddress()); + + return counterparty; + } +} diff --git a/src/test/java/org/openapitools/client/TokenTests.java b/src/test/java/org/openapitools/client/TokenTests.java new file mode 100644 index 00000000..2af211c3 --- /dev/null +++ b/src/test/java/org/openapitools/client/TokenTests.java @@ -0,0 +1,45 @@ +package org.openapitools.client; + + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.openapitools.client.api.CreateCustomerTokenApi; +import org.openapitools.client.api.GetListOrgApiTokensApi; +import org.openapitools.client.model.*; + +import java.util.List; + +public class TokenTests { + @BeforeAll + static void init() { + String access_token = System.getenv("access_token"); + ApiClient cl = new ApiClient(); + cl.setBearerToken(access_token); + Configuration.setDefaultApiClient(cl); + } + + @Test + public void GetOrgTokensTest() throws ApiException { + GetListOrgApiTokensApi listApi = new GetListOrgApiTokensApi(); + List response = listApi.execute("252").getData(); + + for (ApiToken t: response) { + assert t.getType().equals("apiToken"); + } + } + + @Test + public void CreateCustomerToken() throws ApiException { + CreateCustomerTokenApi createApi = new CreateCustomerTokenApi(); + ExecuteRequest16 request = new ExecuteRequest16(); + + CreateCustomerToken cct = new CreateCustomerToken(); + CreateCustomerTokenAttributes attributes = new CreateCustomerTokenAttributes(); + attributes.setScope("customers accounts"); + cct.setAttributes(attributes); + request.setData(cct); + + UnitCustomerTokenResponse res = createApi.execute("1527981", request); + assert res.getData().getType().equals("customerBearerToken"); + } +} diff --git a/src/test/java/org/openapitools/client/unit_photo.png b/src/test/java/org/openapitools/client/unit_photo.png new file mode 100644 index 00000000..5d33aeea Binary files /dev/null and b/src/test/java/org/openapitools/client/unit_photo.png differ